Login to MySQL
$ mysql –u root –p
(password will not visible but we have to type)
Show databases;
mysql> show databases;
Use Database
$ use <database name> Ex:$ use retail_db;
Exit from mysql
mysql> quit;
Working with Database
Create database
create database [If not exists] testdatabase;
Drop database
drop database [If exists] testdatabase;
Create table or temporary table
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table( key type(size) NOT NULL PRIMARY KEY AUTO_INCREMENT, c1 type(size) NOT NULL, c2 type(size) NULL, ... );