FAQ Style Article

Archive for April, 2012|Monthly archive page

MySQL commands

In Work In Progress on April 18, 2012 at 6:05 pm

To login
mysql -u root -p

Create a database on the sql server.
mysql> create database [databasename];

List all databases on the sql server.
mysql> show databases;

Switch to a database.
mysql> use [db name];

To see all the tables in the db.
mysql> show tables;

To see database’s field formats.
mysql> describe [table name];

To delete a db.
mysql> drop database [database name];

To delete a table.
mysql> drop table [table name];

Show all data in a table.
mysql> SELECT * FROM [table name];

Returns the columns and column information pertaining to the designated table.
mysql> show columns from [table name];

SOURCE: http://www.pantz.org/software/mysql/mysqlcommands.html