{"id":5021,"date":"2020-04-14T12:04:32","date_gmt":"2020-04-14T16:04:32","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=5021"},"modified":"2020-04-14T12:04:33","modified_gmt":"2020-04-14T16:04:33","slug":"how-to-delete-mysql-database","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/","title":{"rendered":"How to Delete Mysql Database"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"628\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg\" alt=\"How to delete MySQL Database\" class=\"wp-image-5022\"\/><\/figure>\n\n\n\n<p>In this tutorial, we will show you how to delete MySQL database on Ubuntu 18.04 server.<\/p>\n\n\n\n<p>Creating and deleting the <a href=\"https:\/\/www.mysql.com\/fr\/products\/community\/\">MySQL databases<\/a> is a day-to-day task of any database administrator. You can delete the MySQL databases by using either a command-line interface or PhpMyAdmin web-based interface. In order to delete a MySQL database from your system, you must have a MySQL user account with delete privileges.<\/p>\n\n\n\n<p><strong>Prerequisites<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A <a href=\"https:\/\/www.globo.tech\/dedicated-server-hosting\">server<\/a> running Ubuntu 18.04 with MySQL and <a href=\"https:\/\/www.phpmyadmin.net\/\">PhpMyAdmin<\/a> installed.<\/li><li>MySQL user and password associated with the database or MySQL root password.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Delete MySQL Database with Mysqladmin<\/h2>\n\n\n\n<p>Mysqladmin is a MySQL command-line utility that can be used to perform some basic MySQL tasks including, creating and deleting databases, checking MySQL processes, Setting root password and many more.<\/p>\n\n\n\n<p>Before deleting any database, list all available databases in your system with the following command:<\/p>\n\n\n\n<p><code> mysqlshow -u root -proot-password<\/code><\/p>\n\n\n\n<p>You should see the following output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysqlshow: [Warning] Using a password on the command line interface can be insecure.\n +--------------------+\n |     Databases      |\n +--------------------+\n | information_schema |\n | compressdb         |\n | mysql              |\n | performance_schema |\n | remotedb           |\n | sys                |\n | test1db            |\n | test2db            |\n | testdb             |\n +--------------------+<\/pre>\n\n\n\n<br class=\"custom-break\">\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/mysqlshow-1.png\" alt=\"mysqlshow command to show all databases.\" class=\"wp-image-5023\" width=\"738\" height=\"201\"\/><\/figure>\n\n\n\n<p>Next, delete the database named testdb from the above list by running the following command:<\/p>\n\n\n\n<p><code> mysqladmin -u root -proot-password drop testdb<\/code><\/p>\n\n\n\n<p>You should see the following output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> Dropping the database is potentially a very bad thing to do.\n Any data stored in the database will be destroyed.\n \n \n Do you really want to drop the 'testdb' database [y\/N] y\n Database \"testdb\" dropped<\/pre>\n\n\n\n<br class=\"custom-break\">\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/mysqladmin-drop-db-1.png\" alt=\"Delete a MySQL database using mysqladmin command.\" class=\"wp-image-5024\" width=\"738\" height=\"113\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Delete MySQL Database within MySQL Console<\/h2>\n\n\n\n<p>You can also drop the MySQL database after log into the MySQL console.<\/p>\n\n\n\n<p>First, log into the MySQL console with root user with the following command:<\/p>\n\n\n\n<p><code> mysql -u root -proot-password<\/code><\/p>\n\n\n\n<p>Once login, you should see the following output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> mysql: [Warning] Using a password on the command line interface can be insecure.\n Welcome to the MySQL monitor.  Commands end with ; or \\g.\n Your MySQL connection id is 22\n Server version: 5.7.29-0ubuntu0.18.04.1 (Ubuntu)\n \n \n Copyright (c) 2000, 2020, Oracle and\/or its affiliates. All rights reserved.\n \n \n Oracle is a registered trademark of Oracle Corporation and\/or its\n affiliates. Other names may be trademarks of their respective\n owners.\n \n \n Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.<\/pre>\n\n\n\n<br class=\"custom-break\">\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/mysql-cli-1.png\" alt=\"Log into MySQL cli.\" class=\"wp-image-5025\" width=\"738\" height=\"212\"\/><\/figure>\n\n\n\n<p>Next, list all available databases with the following command:<\/p>\n\n\n\n<p><code> show databases;<\/code><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> +--------------------+\n | Database           |\n +--------------------+\n | information_schema |\n | compressdb         |\n | mysql              |\n | performance_schema |\n | remotedb           |\n | sys                |\n | test1db            |\n | test2db            |\n +--------------------+\n 8 rows in set (0.00 sec)<\/pre>\n\n\n\n<br class=\"custom-break\">\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/show-databases.png\" alt=\"Result of show databases; into mysql cli.\" class=\"wp-image-5026\" width=\"738\" height=\"261\"\/><\/figure>\n\n\n\n<p>Next, delete the MySQL database named test1db from the above list with the following command:<\/p>\n\n\n\n<p><code> drop database test1db;<\/code><\/p>\n\n\n\n<p>Next, exit from the MySQL console with the following command:<\/p>\n\n\n\n<p><code> exit;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/drop-databases.png\" alt=\"Delete MySQL database and exit from mysql cli.\" class=\"wp-image-5027\" width=\"737\" height=\"93\"\/><\/figure>\n\n\n\n<p>You can also remove the MySQL database named test2db without log into the MySQL console as shown below:<\/p>\n\n\n\n<p><code> mysql -u root -proot-password -e \"drop database test2db\";<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Delete MySQL Database with PhpMyAdmin<\/h2>\n\n\n\n<p>First, open your web browser and access the PhpMyAdmin web UI.  You should see the following page:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/phpmyadmin.png\" alt=\"phpMyAdmin login screen.\" class=\"wp-image-5029\" width=\"623\" height=\"324\"\/><\/figure>\n\n\n\n<p>Provide your MySQL root username, password and click on the <strong>Go<\/strong> button. You will be redirected to the PhpMyAdmin dashboard in the following page:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/phpmyadmin-2.png\" alt=\"phpMyAdmin home screen.\" class=\"wp-image-5030\" width=\"648\" height=\"337\"\/><\/figure>\n\n\n\n<p>Now, click on the <strong>Databases<\/strong>, you should see all the databases in the following page:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/phpmyadmin-3.png\" alt=\"phpMyAdmin databases list.\" class=\"wp-image-5031\" width=\"650\" height=\"337\"\/><\/figure>\n\n\n\n<p>Now, select the database you want to delete and click on the <strong>Drop<\/strong> button to delete the selected database. You will be prompt to confirm as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/phpmyadmin-4.png\" alt=\"Confirm to delete MySQL database using phpMyAdmin.\" class=\"wp-image-5032\" width=\"643\" height=\"334\"\/><\/figure>\n\n\n\n<p>Click on the <strong>OK<\/strong> button to delete the database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>In the above guide, you learned how to drop a MySQL database <a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\">server<\/a> with command-line and PhpMyAdmin. I hope this will helps you to perform your day-to-day operations.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Learn how to delete a MySQL Database. MySQL is a loved popular database engine that run on Linux and Windows servers.<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":5022,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[161,170,24,171,169],"class_list":["post-5021","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database","tag-database","tag-delete","tag-mysql","tag-phpmyadmin","tag-remove"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Delete Mysql Database - Globo.Tech<\/title>\n<meta name=\"description\" content=\"Learn how to delete a MySQL Database. MySQL is a loved and very popular database engine that run on Linux and Windows servers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Delete Mysql Database - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"Learn how to delete a MySQL Database. MySQL is a loved and very popular database engine that run on Linux and Windows servers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-14T16:04:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-14T16:04:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/\",\"name\":\"How to Delete Mysql Database - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg\",\"datePublished\":\"2020-04-14T16:04:32+00:00\",\"dateModified\":\"2020-04-14T16:04:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"Learn how to delete a MySQL Database. MySQL is a loved and very popular database engine that run on Linux and Windows servers.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#primaryimage\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg\",\"contentUrl\":\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg\",\"width\":1200,\"height\":628,\"caption\":\"How to delete MySQL Database\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.globo.tech\/learning-center\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Delete Mysql Database\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#website\",\"url\":\"https:\/\/www.globo.tech\/learning-center\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\/\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Delete Mysql Database - Globo.Tech","description":"Learn how to delete a MySQL Database. MySQL is a loved and very popular database engine that run on Linux and Windows servers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/","og_locale":"en_US","og_type":"article","og_title":"How to Delete Mysql Database - Globo.Tech","og_description":"Learn how to delete a MySQL Database. MySQL is a loved and very popular database engine that run on Linux and Windows servers.","og_url":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/","og_site_name":"Globo.Tech","article_published_time":"2020-04-14T16:04:32+00:00","article_modified_time":"2020-04-14T16:04:33+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg","type":"image\/jpeg"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/","url":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/","name":"How to Delete Mysql Database - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#primaryimage"},"image":{"@id":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#primaryimage"},"thumbnailUrl":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg","datePublished":"2020-04-14T16:04:32+00:00","dateModified":"2020-04-14T16:04:33+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"Learn how to delete a MySQL Database. MySQL is a loved and very popular database engine that run on Linux and Windows servers.","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#primaryimage","url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg","contentUrl":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2020\/04\/delete-mysql-database.jpg","width":1200,"height":628,"caption":"How to delete MySQL Database"},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/how-to-delete-mysql-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Delete Mysql Database"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/5021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=5021"}],"version-history":[{"count":7,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/5021\/revisions"}],"predecessor-version":[{"id":5039,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/5021\/revisions\/5039"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media\/5022"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=5021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=5021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=5021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}