6.07.2009

Managing the Database

CREATE DB:

To create a database in MySQL, you use the CREATE DATABASE statement:

Command: CREATE DATABASE [IF NOT EXISTS] database_name;
OR: CREATE DATABASE database_name;

CREATE DATABASE statement will create the database with the given name you specified. IF NOT EXISTS is an option part of the statement, this part prevents you from error if there is a database with the given name exists on the database server.

SHOW DB:

SHOW DATABASE statement will show all databases in your server.
Command: SHOW DATABASES;

SELECT DB:

To select a database which you will work with, you use this statement.
Command: USE database_name;

REMOVE DB:

Removing database means you delete the database, all the data and related objects inside the database permanently and cannot undo it.
Command: DROP DATABASE [IF EXISTS] database_name;

Link -1 : www.mysqltutorial.org