MySQL Command Reference

Login to MySQL:

~$ mysql -u username -p

Create a database:

create database db_name;

Delete a database:

drop database db_name;

List all databases:

show databases;

Select a database:

use db_name;

List tables of current database:

show tables;

List fields of a table:

describe table_name;

Table query structure:

select * from table_name where id = "5" 

Export a MySQL Database:

~$ mysqldump -u username -p db_name > FILE.sql 

Import a MySQL Database:

~$ mysql -u username -p db_name < FILE.sql 
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s