Useful MySQL Commands


Command

Purpose

mysql -h mysql.wiu.edu -P <your port number> -u <your MySQL user-id> -p

 

Command used from the Unix prompt to start a MySQL session.
SHOW DATABASES;

 

Lists the databases managed by the server.
USE <database name>;

 

To select one of the databases for use.
SELECT DATABASE( );

 

To find out which database is currently selected
SHOW TABLES;

 

To find out what tables the current database contains.
DESCRIBE <table name>;

 

To find out about the structure of a table, the DESCRIBE command is useful; it displays information about each of a table's columns.
SHOW CREATE TABLE <table-name>;

 

Creates a listing of the SQL required to recreate the table.