Home / Software / How to Delete Tables and Rows in MySQL

How to Delete Tables and Rows in MySQL

mysqlAs I mentioned in a previous MySQL post, knowing how to quickly perform database tasks from the command line is a good idea if you are a Linux system administrator. Sometimes, it is the easier way to get things done, especially if you are helping another user and need root access to his or her database.

To delete a table, first login to MySQL:

mysql -u root -p

Enter your password and then switch to the database you want to edit by typing the following at the mysql> prompt:

mysql> use [db name];

Finally, drop the table:

mysql> drop table [table name];

Replace [table name] with the actual name of the table you want to remove.

To remove a row, type:

mysql> DELETE from [table name] where [field name] = 'whatever';

When you are finished, type “quit” to exit.

Check Also

Uk data center

Professional Data Centres In The UK

A professional data centre is a location in which various pieces of hardware are located …