MySQL Database Operation

In this tutorial, you will know how to create database and get list of databases.

Get list of all databases of the server

To get list of all databases of the server where mysql is currently running, run the SHOW command as shown below.

mysql>SHOW DATABASES;

SHOW Databases does not display those databases that has no priviledge to show.

Create Database

If your administrator provide you priviledge to create database, then you can create it yourself. To create a new database run the given command-

mysql->CREATE Database school;    

If you are working under UNIX, database names are case sentitive. createdatabase

Select Database

To select a database for use or to perform operations, run the USE command, as shown below.

mysql>Use school    
This command does not require semicolon.

Creating a database does not make it for use. For using a database we must call USE command. USE command does not require semicolon at the end of sentance.

selectdatabase

Delete a database

DROP command is used to drop a database. Suppose you want to delete a database named company. Run the following command -

mysql>DROP DATABASE company;    
    



Read more articles


General Knowledge



Learn Popular Language