• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
The Customize Windows > Computer and Internet > Cloud Computing > Delete MySQL Database From Command Line

By Abhishek Ghosh September 3, 2014 2:35 pm Updated on September 3, 2014

Delete MySQL Database From Command Line

Advertisement

Here is how to delete MySQL database from Command Line Interface or SSH using MySQL drop database command. It is quite simple and easy. Previously, we have shown how to export WordPress MySQL Database on Rackspace Deployment using only Command Line Interface. MySQL by default has quite powerful interactive interface. PHPMyAdmin is a risk itself if run for production environment. Before the reader is going to delete MySQL database from Command Line, we recommend to take a backup of the whole server although if properly done, this can not be a risk to other databases.

 

Commands to Delete MySQL Database From Command Line

 

For example, in the guide for installing Piwik on nginx on Ubuntu 14.04 on Rackspace Cloud, we really installed Piwik on production environment and understood it is far from our expectation. Only recursively deleting the web software is not a good idea for security reasons. If you have old MySQL database, make sure the name is correct. References can be found here :

Vim
1
http://dev.mysql.com/doc/refman/5.0/en/drop-database.html

 
Delete MySQL Database From Command Line

Advertisement

---

First, SSH to the database server as server’s root user. MySQL root user might have different password. This command to login to MySQL as root usually works fine :

Vim
1
2
3
4
5
6
mysql -u root -p
# you are root, give password
# welcome message followed by
# mysql interactive mode like this
# mysql >
# will start

The syntax to delete MySQL database is :

Vim
1
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name

But we will run this to get the list of all databases :

Vim
1
2
3
4
5
show databases;
# will look like
mysql >
mysql > show databases;
# hit return or Enter key

It will return thing like this :

Vim
1
2
3
4
5
6
7
8
9
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| your-db-to-delete  |
| your-another-db    |
| your-db-to-here    |
+--------------------+

You want to delete that database named your-db-to-delete; in that case you’ll run :

Vim
1
2
3
4
5
6
7
8
9
drop database your-db-to-delete;
# alternate 1
# drop database your-db-to-delete
# alternate 2
# drop schema your-db-to-delete;
## will look like
mysql >
mysql > drop database your-db-to-delete
## hit return or Enter key

Again reload the databases :

Vim
1
show databases;

And flash the privileges :

Vim
1
FLUSH PRIVILEGES;

If you had an user WHO WAS THE ONLY USER OF THAT INTENDED TO DELETE DATABASE, you must delete it too :

Vim
1
2
3
4
5
drop user user_name;
# user_name is variable
# like abhishek
# like wordpress
# like foo

Again flush the privileges.

Tagged With mysql drop database command , mysql delete data from table command in centos from ssh , ssh remove database , mysql command line drop database висит , delete table data quickly using ssh in mysql , delete mysql databases ssh , delete database ssh , delete database phpmyadmin command line , delete database in mysql from command line , delete data base using mysql cli

This Article Has Been Shared 5609 Times!

Facebook Twitter Google+ Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Delete MySQL Database From Command Line

  • MySQL InnoDB Optimization From my.cnf

    On Rackspace Cloud Server PVHVM, We Can Further Optimize MySQL. Here are some performance tweaks for MySQL InnoDB optimization from my.cnf.

  • Installing WordPress on Rackspace Cloud Server with Cloud Database

    Installing WordPress on Rackspace Cloud Server with Cloud Database can give you a good performance with scalable and economically best solution. Simple Guide.

  • CRM SaaS and Market Trends

    CRM SaaS and Market Trends will remain stable despite there is fall in the SaaS consumption due to data theft and increased awareness of Privacy on Cloud.

  • Secure Cloud Computing : A Short Handy Guide

    Secure Cloud Computing is a Big Chapter. An Average User Need Not to Know All the Terminologies. Here is a Simplified Guide in Plain English.

  • zlib.output_compression Should Be Off on Cloud Server for Performance

    zlib.output_compression, Specifically for PHP-MySQL Web Software Like WordPress Should Be Off on Cloud Server for Performance. Here is Why.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us



Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (15K Followers)
  • Twitter (4.4k Followers)
  • Facebook (5.2k Followers)
  • LinkedIn (3.3k Followers)
  • YouTube (1.5k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • 6 Tips for Securing Your Data from Cyber Attacks as a Remote Worker December 11, 2019
  • What is Process Mining? December 10, 2019
  • Explanation of the ESP32 Vulnerability Warnings December 6, 2019
  • OLTP versus OLAP December 4, 2019
  • What is OLTP (Online Transaction Processing)? December 3, 2019

About This Article

Title: Delete MySQL Database From Command Line
2014-09-03

Author: Abhishek Ghosh
Subjects: Cloud Computing

Is Part Of:


TheCustomizeWindows,

Wednesday, September 3rd, 2014,
Vol.1(01),
p.1–41869 [IoT Ready Journal]


Source:The Customize Windows
ISSN: 0019-5847 ;
E-ISSN: 0019-5847 ;
Publisher:
jima.in

Cite this article as: Abhishek Ghosh, "Delete MySQL Database From Command Line," in The Customize Windows, September 3, 2014, December 16, 2019, https://thecustomizewindows.com/2014/09/delete-mysql-database-from-command-line/.

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.


PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

web analysis

Copyright © 2019 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy