Mysql Database

MySQL server stores data in rows form. These rows are stored in tables. All tables are stored in the databases. In this way you can say that database MySQL is the primary unit of data representation and storage.

Let us now see how the databases in MySQL are created and used.

Create Databases

To create a database in MySQL, you use the CREATE statement. The general syntax of this statement is being given below.

mysql> create database database_Name;


If you want to see which and how many databases are in the MySQL server then you can do this by using the SHOW statement. An example of this is being given below.

mysql> show databases;

This statement shows the list of all the databases available in the server.


Once you have created a database, to create tables in that database, you will need to switch from the current database to that database. You use the USE statement for this. An example of this is being given below.

mysql> use test_db;

This statement gives you control over the test_db database. Now you can work in this database.