{"id":5272,"date":"2022-10-26T12:11:52","date_gmt":"2022-10-26T09:11:52","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=5272"},"modified":"2026-11-18T14:37:37","modified_gmt":"2026-11-18T12:37:37","slug":"how-to-delete-a-mysql-database","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-delete-a-mysql-database\/","title":{"rendered":"How to Delete a MySQL Database (4 Methods)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">MySQL is one of the most widely used relational database management systems, powering a large share of today&#8217;s websites and web applications. Your project likely relies on it too, and your hosting account may hold several databases: live ones, staging copies, and leftovers from apps you removed long ago.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Getting rid of the databases you no longer need keeps your account tidy and removes data you don&#8217;t want lying around. Deletion is permanent, though, so it pays to do it carefully.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide walks you through five ways to delete a MySQL database, plus the checks to run before you start and the cleanup to do afterward.<\/p>\n\n\n\n<p class=\"alert-green wp-block-paragraph\"><strong>Quick answer:<\/strong> Log in to MySQL with an account that has the DROP privilege on the database and run DROP DATABASE database_name;. MySQL deletes the database and every table in it immediately, with no confirmation and no undo, so back it up first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Which method should you use?<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-regular green-rows\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Method<\/strong><\/td><td><strong>Best for<\/strong><\/td><td><strong>What you need<\/strong><\/td><td><strong>Asks you to confirm?<\/strong><\/td><\/tr><tr><td><strong>Command line<\/strong> (DROP DATABASE)<\/td><td>Developers, scripts, servers without a graphical interface<\/td><td>SSH access and a MySQL account with the DROP privilege<\/td><td>No<\/td><\/tr><tr><td><strong>mysqladmin<\/strong><\/td><td>Quick one-line deletion from the shell<\/td><td>SSH access and a MySQL account with the DROP privilege<\/td><td>Yes (unless you use &#8211;force)<\/td><\/tr><tr><td><strong>phpMyAdmin<\/strong><\/td><td>Point-and-click deletion on shared or managed hosting<\/td><td>phpMyAdmin login<\/td><td>Yes<\/td><\/tr><tr><td><strong>SPanel<\/strong><\/td><td>ScalaHosting customers who want to remove databases and users in one place<\/td><td>SPanel login<\/td><td>Yes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Before You Delete a MySQL Database<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A deleted database can&#8217;t be restored unless you have a backup. Spend two minutes on these checks first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check also: <a href=\"https:\/\/www.scalahosting.com\/kb\/how-to-create-a-database-in-mysql\/\">How to Create a MySQL Database<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Make sure nothing still uses the database<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If a website or application is still connected to the database, deleting it will take that site offline. WordPress, for example, will show an &#8220;<em>Error establishing a database connection<\/em>&#8221; message.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check your application&#8217;s configuration file for the database name. In WordPress, it&#8217;s the <strong>DB_NAME<\/strong> value in <strong>wp-config.php<\/strong>. Other applications usually keep it in a .env or config file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Check what&#8217;s inside<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;re logged in to the MySQL console (see Method 1), this query shows how many tables the database holds and how much space they take up:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">SELECT COUNT(*) AS tables, ROUND(SUM(data_length + index_length)\/1024\/1024, 1) AS size_mb FROM information_schema.tables WHERE table_schema = &#8216;database_name&#8217;;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-01-check-database-size-1024x354.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"354\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-01-check-database-size-1024x354.webp\" alt=\"How to Delete a MySQL Database (4 Methods), 2. Check what&#8217;s inside\" class=\"wp-image-6576\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-01-check-database-size-1024x354.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-01-check-database-size-300x104.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-01-check-database-size-767x265.webp 767w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-01-check-database-size.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Checking the number of tables and the size of the database before deleting it.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you see more tables or data than you expected, stop and double-check that you have the right database.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Back up the database<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Even if you&#8217;re sure you&#8217;ll never need the data again, a backup costs nothing and protects you from deleting the wrong database. From the command line, use mysqldump:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">mysqldump -u [username] -p [database_name] &gt; [database_name]-backup.sql<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-02-mysqldump-backup-1024x198.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"198\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-02-mysqldump-backup-1024x198.webp\" alt=\"How to Delete a MySQL Database (4 Methods), 3. Back up the database\" class=\"wp-image-6577\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-02-mysqldump-backup-1024x198.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-02-mysqldump-backup-300x58.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-02-mysqldump-backup-766x148.webp 766w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-02-mysqldump-backup.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Exporting the database to a .sql file with mysqldump before dropping it.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Download the .sql file to your computer or keep it somewhere outside the database server. You can also use your control panel&#8217;s backup tool, if it has one.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Check your privileges<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To delete a database, your MySQL account needs the <strong>DROP<\/strong> privilege on it. Accounts with the global DROP privilege, such as root, can delete any database on the server. Regular hosting accounts can usually delete only the databases assigned to them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Method 1: How to Delete a MySQL Database From the Command Line<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The traditional way to delete a MySQL database is with the DROP DATABASE statement in the MySQL console.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you don&#8217;t have much experience with the command line, you may find it a bit intimidating. In practice, there&#8217;s little that can go wrong if you approach the task carefully and check each command before you press Enter.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Log in to your hosting account via SSH<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are several ways to open an <a href=\"https:\/\/www.scalahosting.com\/blog\/what-is-ssh-and-how-to-use-it\/\">SSH (Secure Shell) connection<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can use your operating system&#8217;s built-in command-line tool. On Windows, that&#8217;s <strong>Command Prompt<\/strong> or <strong>PowerShell<\/strong>. On macOS and Linux, you have the default <strong>Terminal app<\/strong> as well as plenty of third-party alternatives.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The command for opening a shell looks like this:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">ssh [username]@[server_IP]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the server uses a custom SSH port instead of the default port 22, add -p followed by the port number, for example <strong>ssh example_user@203.0.113.10 -p 6543<\/strong>. After you authenticate, the server starts the session.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-03-ssh-login-1024x172.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"172\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-03-ssh-login-1024x172.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 1: Log in to your hosting account via SSH\" class=\"wp-image-6578\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-03-ssh-login-1024x172.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-03-ssh-login-300x50.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-03-ssh-login-768x129.webp 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-03-ssh-login.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Connecting to the hosting account over SSH on a custom port.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A second option is a dedicated client such as <strong>PuTTY<\/strong>. Native SSH support is now available on all major operating systems, but some people still prefer dedicated clients for their extra features and saved sessions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you use SPanel, you have a third option: log in to the User Interface and open the <strong>SSH Terminal<\/strong>. SPanel opens a shell for you right in the browser.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase1-1024x405.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"405\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase1-1024x405.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 1: Log in to your hosting account via SSH 2\" class=\"wp-image-6579\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase1-1024x405.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase1-300x119.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase1-766x303.webp 766w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase1.webp 1067w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Log in to the MySQL console<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Log in with a MySQL account that has the DROP privilege on the database you want to remove:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">mysql -u [username] -p<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-04-mysql-console-login-1024x302.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"302\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-04-mysql-console-login-1024x302.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 2: Log in to the MySQL console\" class=\"wp-image-6580\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-04-mysql-console-login-1024x302.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-04-mysql-console-login-300x88.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-04-mysql-console-login-767x226.webp 767w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-04-mysql-console-login.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Logging in to the MySQL console.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Enter your password when prompted. Once you&#8217;re in, the prompt changes to <strong>mysql&gt;<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Find the exact name of the database<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">From now on, you&#8217;ll be typing SQL statements. The syntax for simple tasks like this one is straightforward, but a few details tend to catch beginners out:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>SQL keywords aren&#8217;t case-sensitive.<\/strong> Writing them in uppercase (DROP DATABASE rather than drop database) is a convention that makes statements easier to read, not a requirement.<\/li>\n\n\n\n<li><strong>Database names usually are case-sensitive.<\/strong> On Linux servers, Example_Shop and example_shop are two different databases.<\/li>\n\n\n\n<li><strong>Every SQL statement ends with a semicolon.<\/strong> If you forget it, MySQL shows a -> prompt and waits for more input. Type ; and press Enter to run the statement.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Because there&#8217;s no undo, make sure you have the exact name of the database. List all the databases your account can see with:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">SHOW DATABASES;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-05-show-databases-1024x406.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"406\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-05-show-databases-1024x406.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 3: Find the exact name of the database\" class=\"wp-image-6581\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-05-show-databases-1024x406.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-05-show-databases-300x119.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-05-show-databases-768x304.webp 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-05-show-databases.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>SHOW DATABASES lists every database your MySQL account can access.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Note the exact name of the database you want to delete. Leave the system schemas (information_schema, performance_schema, mysql, and sys) alone: MySQL needs them to work.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: DROP DATABASE in MySQL<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The DROP DATABASE statement looks like this:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">DROP DATABASE [database_name];<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-06-drop-database-command-1024x172.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"172\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-06-drop-database-command-1024x172.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 4: DROP DATABASE in MySQL\" class=\"wp-image-6582\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-06-drop-database-command-1024x172.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-06-drop-database-command-300x50.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-06-drop-database-command-768x129.webp 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-06-drop-database-command.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>DROP DATABASE removes the database and all of its tables.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;rows affected&#8221; number in the output is the number of tables MySQL removed. There&#8217;s no &#8220;Are you sure?&#8221; prompt, so double-check the name and your backup before you press Enter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some useful variations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>DROP DATABASE IF EXISTS [database_name];<\/strong> doesn&#8217;t return an error if the database doesn&#8217;t exist, which is handy in scripts.<\/li>\n\n\n\n<li>If the name contains a hyphen or other special characters, wrap it in backticks, as in DROP DATABASE `example-staging`; otherwise MySQL returns a syntax error.<\/li>\n\n\n\n<li><strong>DROP SCHEMA<\/strong> is a synonym for DROP DATABASE and works exactly the same way.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-07-backticks-special-characters-1024x276.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"276\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-07-backticks-special-characters-1024x276.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 4: DROP DATABASE in MySQL 2\" class=\"wp-image-6583\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-07-backticks-special-characters-1024x276.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-07-backticks-special-characters-300x81.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-07-backticks-special-characters-765x206.webp 765w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-07-backticks-special-characters.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Database names with hyphens must be wrapped in backticks.<\/em><\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Confirm the database is gone<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL&#8217;s output isn&#8217;t very descriptive: all you get is a Query OK message. To confirm the deletion, run SHOW DATABASES; again and check that the database is no longer listed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-08-verify-deletion-1024x354.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"354\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-08-verify-deletion-1024x354.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 5: Confirm the database is gone\" class=\"wp-image-6584\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-08-verify-deletion-1024x354.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-08-verify-deletion-300x104.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-08-verify-deletion-767x265.webp 767w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-08-verify-deletion.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>The example_shop database no longer appears in the list.<\/em><\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 6: Clean up the database user (optional)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Deleting a database doesn&#8217;t delete the MySQL users connected to it, and it doesn&#8217;t remove the privileges granted on it. Those stay until you remove them yourself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the user existed only to access this database, check its grants and then delete it:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">SHOW GRANTS FOR &#8216;[user]&#8217;@&#8217;localhost&#8217;;<br>DROP USER &#8216;[user]&#8217;@&#8217;localhost&#8217;;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-09-drop-database-user-1024x406.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"406\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-09-drop-database-user-1024x406.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 6: Clean up the database user (optional)\" class=\"wp-image-6585\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-09-drop-database-user-1024x406.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-09-drop-database-user-300x119.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-09-drop-database-user-768x304.webp 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-09-drop-database-user.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>Checking a user&#8217;s grants before removing the user with DROP USER.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If the user also works with other databases, remove only the privileges for the deleted one with REVOKE ALL PRIVILEGES ON [database_name].* FROM &#8216;[user]&#8217;@&#8217;localhost&#8217;;. If you created the user in a control panel such as SPanel, delete it there instead, so the panel&#8217;s records stay in sync.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Method 2: How to Delete a Database With mysqladmin<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">mysqladmin is a command-line client for MySQL administration. It can set and change passwords, check status variables, list client threads, and more. It can also delete databases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It runs from the shell, so you first need to log in to your hosting account via SSH. You&#8217;ll also need the database name and the login details of a MySQL account that has the DROP privilege on it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The command looks like this:<\/p>\n\n\n\n<p class=\"alert-orange wp-block-paragraph\">mysqladmin -u [username] -p drop [database_name]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This isn&#8217;t an SQL statement. You run it directly from the shell without logging in to the MySQL console, so it doesn&#8217;t need a semicolon at the end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unlike DROP DATABASE, mysqladmin warns you that dropping the database will destroy all of its data and asks you to confirm. Type <strong>y<\/strong> and press Enter, and mysqladmin tells you the database has been dropped.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-10-mysqladmin-drop-1024x276.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"276\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-10-mysqladmin-drop-1024x276.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Method 2: How to Delete a Database With mysqladmin\" class=\"wp-image-6586\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-10-mysqladmin-drop-1024x276.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-10-mysqladmin-drop-300x81.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-10-mysqladmin-drop-765x206.webp 765w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/delete-mysql-database-10-mysqladmin-drop.webp 1500w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><figcaption class=\"wp-element-caption\"><em>mysqladmin asks for confirmation before it drops the database.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"alert-blue wp-block-paragraph\"><strong>Tip:<\/strong> The &#8211;force (-f) option skips the confirmation prompt. That&#8217;s useful in automated scripts, but it also removes your last safety net, so use it with care.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Method 3: How to Delete a Database in phpMyAdmin<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">phpMyAdmin is a web-based tool for managing MySQL databases that comes with many shared and managed hosting accounts. It&#8217;s built into several popular control panels, including cPanel and SPanel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Its graphical interface means you don&#8217;t need to remember any commands. Deleting a database takes just a few clicks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Log in to phpMyAdmin<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use a MySQL account that has the DROP privilege on the database. You can usually open phpMyAdmin from your control panel. The default standalone address is https:\/\/[server_IP]\/phpmyadmin\/, but many hosting providers change it for security reasons.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase2-1024x350.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"350\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase2-1024x350.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 1: Log in to phpMyAdmin\" class=\"wp-image-6587\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase2-1024x350.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase2-300x103.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase2-766x262.webp 766w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase2-1536x526.webp 1536w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase2.webp 1917w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Open the Databases tab and select the database<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>Databases<\/strong> tab lists your account&#8217;s databases along with a couple of system schemas such as information_schema and performance_schema. Find the database you want to delete and tick the checkbox next to it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Click Drop and confirm<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Click <strong>Drop<\/strong> below the list of databases. The exact position can vary slightly between phpMyAdmin versions and themes. phpMyAdmin then shows the DROP DATABASE query it&#8217;s about to run and asks you to confirm. Click <strong>OK<\/strong> (or <strong>Yes<\/strong>) to delete the database.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase3-1024x443.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"443\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase3-1024x443.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 3: Click Drop and confirm\" class=\"wp-image-6588\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase3-1024x443.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase3-300x130.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase3-766x331.webp 766w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase3.webp 1416w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Alternatively, click the database name in the left sidebar, open the <strong>Operations<\/strong> tab, and click <strong>Drop the database (DROP)<\/strong>.<\/p>\n\n\n\n<p class=\"alert-blue wp-block-paragraph\"><strong>Note:<\/strong> Some hosting providers disable deleting databases from phpMyAdmin. If you don&#8217;t see the Drop option, delete the database from your control panel instead (see Method 4 for SPanel).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Method 4: How to Delete a Database in SPanel<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SPanel is ScalaHosting&#8217;s all-in-one server management platform. It includes tools for creating, managing, and deleting MySQL databases and their users, so removing a database takes just a few clicks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Log in to SPanel&#8217;s User Interface<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, open the SPanel account that hosts the database. There are two ways to do this.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re the server administrator, log in to the <strong>Admin Interface<\/strong>. The homepage lists all accounts on the server. Find the one you need, open its <strong>Actions<\/strong> menu, and click <strong>Manage<\/strong>. SPanel takes you straight to that account&#8217;s User Interface.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase4-1024x377.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"377\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase4-1024x377.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 1: Log in to SPanel&#8217;s User Interface\" class=\"wp-image-6589\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase4-1024x377.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase4-300x110.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase4-766x282.webp 766w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase4.webp 1535w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you have the account&#8217;s login details, you can also sign in directly at https:\/\/[your_domain]\/spanel\/.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Open MySQL Databases and find the database<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Click <strong>MariaDB Databases<\/strong> on the homepage of SPanel&#8217;s User Interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your existing databases are listed below the forms for creating databases and users. If you have many databases, use the search box or move to the next page of results.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase5-1024x519.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"519\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase5-1024x519.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 2: Open MySQL Databases and find the database\" class=\"wp-image-6590\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase5-1024x519.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase5-300x152.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase5-767x389.webp 767w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase5-1536x779.webp 1536w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase5.webp 1621w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Delete the database<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To delete a single database, open the <strong>Actions<\/strong> drop-down menu next to it and select <strong>Drop Database<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase6-1024x385.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"385\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase6-1024x385.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 3: Delete the database\" class=\"wp-image-6591\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase6-1024x385.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase6-300x113.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase6-766x288.webp 766w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase6-1536x578.webp 1536w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase6.webp 1760w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To delete several databases at once, tick the checkboxes next to them and click <strong>Delete Selected<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase7-1024x433.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"433\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase7-1024x433.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 3: Delete the database 2\" class=\"wp-image-6592\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase7-1024x433.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase7-300x127.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase7-768x325.webp 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase7-1536x650.webp 1536w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase7.webp 1621w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">SPanel asks you to confirm before it deletes anything.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Remove unused database users<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Database users aren&#8217;t deleted together with their databases. Scroll to the list of MySQL users at the bottom of the page and remove any you no longer need, either with the <strong>Delete<\/strong> button next to each user or by ticking several checkboxes at once.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large mpg-gallery\"><a href=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase8-1024x520.webp\" data-fancybox=\"gallery\" data-caption=\"\" class=\"fb-gal-img-wrap fb-gal-link\"><img decoding=\"async\" width=\"1024\" height=\"520\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase8-1024x520.webp\" alt=\"How to Delete a MySQL Database (4 Methods), Step 4: Remove unused database users\" class=\"wp-image-6593\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase8-1024x520.webp 1024w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase8-300x152.webp 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase8-768x390.webp 768w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase8-1536x780.webp 1536w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/10\/mysqldatabase8.webp 1620w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Troubleshooting Common Errors<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-regular green-rows\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Error or symptom<\/strong><\/td><td><strong>What it means<\/strong><\/td><td><strong>How to fix it<\/strong><\/td><\/tr><tr><td>ERROR 1044 (42000): Access denied for user &#8230; to database &#8230;<\/td><td>Your MySQL account doesn&#8217;t have the DROP privilege on this database.<\/td><td>Log in with an account that has the privilege, or delete the database from your control panel.<\/td><\/tr><tr><td>ERROR 1008 (HY000): Can&#8217;t drop database &#8230;; database doesn&#8217;t exist<\/td><td>The name is wrong (check the spelling, letter case and any username prefix), or the database is already gone.<\/td><td>Run SHOW DATABASES; to get the exact name, or use DROP DATABASE IF EXISTS.<\/td><\/tr><tr><td>ERROR 1064 (42000): You have an error in your SQL syntax<\/td><td>Usually caused by a database name with a hyphen or other special characters.<\/td><td>Wrap the name in backticks: DROP DATABASE `my-database`;<\/td><\/tr><tr><td>ERROR 1010 (HY000): Error dropping database (can&#8217;t rmdir &#8230;)<\/td><td>Files that MySQL didn&#8217;t create are still in the database&#8217;s directory on the server.<\/td><td>On your own server, remove the leftover files from the database directory and run the statement again. On managed hosting, contact support.<\/td><\/tr><tr><td>The statement hangs with no output<\/td><td>Another connection, such as your website, is using the database&#8217;s tables, and MySQL is waiting for it to finish.<\/td><td>Stop the application or wait for its queries to finish. SHOW PROCESSLIST; shows the active connections.<\/td><\/tr><tr><td>The prompt changes to -><\/td><td>You pressed Enter without ending the statement with a semicolon.<\/td><td>Type ; and press Enter.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Frequently Asked Questions<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q:<\/strong> <strong>Can I recover a deleted MySQL database?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A:<\/strong> Not from MySQL itself: there&#8217;s no recycle bin or undo. You can restore the database only from a backup, such as a mysqldump file or your host&#8217;s backups. If binary logging was enabled on the server, a point-in-time recovery may also be possible. That&#8217;s why you should always back up the database before you drop it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q:<\/strong> <strong>Does deleting a database also delete its users?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A:<\/strong> No. MySQL users and the privileges granted on the database remain until you remove them yourself with DROP USER or REVOKE, or in your control panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q:<\/strong> <strong>What&#8217;s the difference between DROP DATABASE, DROP TABLE and TRUNCATE?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A:<\/strong> DROP DATABASE removes the whole database with all its tables. DROP TABLE removes individual tables and leaves the database in place. TRUNCATE TABLE empties a table but keeps its structure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q:<\/strong> <strong>Is DROP SCHEMA the same as DROP DATABASE?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A:<\/strong> Yes. In MySQL, &#8220;schema&#8221; and &#8220;database&#8221; mean the same thing, and the two statements work identically.<\/p>\n\n\n\n<script type=\"application\/ld+json\">\n    {\n      \"@context\": \"https:\/\/schema.org\",\n      \"@type\": \"FAQPage\",\n      \"mainEntity\": [{\n        \"@type\": \"Question\",\n        \"name\": \"Can I recover a deleted MySQL database?\",\n        \"acceptedAnswer\": {\n          \"@type\": \"Answer\",\n          \"text\": \"Not from MySQL itself: there's no recycle bin or undo. You can restore the database only from a backup, such as a mysqldump file or your host's backups. If binary logging was enabled on the server, a point-in-time recovery may also be possible. That's why you should always back up the database before you drop it.\"\n        }\n      }, {\n        \"@type\": \"Question\",\n        \"name\": \"Does deleting a database also delete its users?\",\n        \"acceptedAnswer\": {\n          \"@type\": \"Answer\",\n          \"text\": \"No. MySQL users and the privileges granted on the database remain until you remove them yourself with DROP USER or REVOKE, or in your control panel.\"\n        }\n      },{\n        \"@type\": \"Question\",\n        \"name\": \"What's the difference between DROP DATABASE, DROP TABLE and TRUNCATE?\",\n        \"acceptedAnswer\": {\n          \"@type\": \"Answer\",\n          \"text\": \"DROP DATABASE removes the whole database with all its tables. DROP TABLE removes individual tables and leaves the database in place. TRUNCATE TABLE empties a table but keeps its structure.\"\n        }\n      },{\n        \"@type\": \"Question\",\n        \"name\": \"Is DROP SCHEMA the same as DROP DATABASE?\",\n        \"acceptedAnswer\": {\n          \"@type\": \"Answer\",\n          \"text\": \"Yes. In MySQL, 'schema' and 'database' mean the same thing, and the two statements work identically.\"\n        }\n      }]\n    }\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>MySQL is one of the most widely used relational database management systems, powering a large share of today&#8217;s websites and web applications. Your project likely relies on it too, and your hosting account may hold several databases: live ones, staging copies, and leftovers from apps you removed long ago. Getting rid of the databases you [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5379,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-5272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-hosting"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/5272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=5272"}],"version-history":[{"count":10,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/5272\/revisions"}],"predecessor-version":[{"id":6596,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/5272\/revisions\/6596"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media\/5379"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=5272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=5272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=5272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}