Linux, Linux.Tips

List of most useful MySQL Commands

Less than a minute to read

This article is designed to be used as a reference for most useful MySQL commands and is regularly updated for improvements.

Connect to MySQL RDBMS using Terminal

mysql -h hostname -u username -p

Create a new database

mysql> create database DB_NAME;

Show all databases on the server

mysql> show databases;

Access a specific database

mysql> use DB_NAME;

List tables in a database

mysql> show tables;

Get the table structure

mysql> describe TABLE_NAME;

Delete a database

mysql> drop database DB_NAME;

Delete a table

mysql> drop table TABLE_NAME;


Leave a Reply