Ads by ProfitSence

Creating a MySQL Database and Tables

Last Updated on Wednesday 5th Oct 2022

Create database

  • The create database statement creates the database with the specified name.
					Create database database_name;


Here, database_name is the name of the new database to be created.

mysql create database

					MySQL > create database wordpress;
Query OK, 1 row affected (0.01 sec)

  • To confirm that our wordpress database has been successfully created.
  • We will use the show databases statement to see the list of existing databases on the MYSQL Server.
					MySQL > show databases;

| Database           |
| wordpress          |
| oldOne             |

  • Now, we will apply the use statement to access the wordpress database.

mysql select database

					MySQL [(none)]> use wordpress;
Database changed


Now, the wordpress database is in use, so whatever SQL commands we will give will be applied only to the wordpress database.

Create the table

This creates a database table with the specified name.

					CREATE TABLE table_name (column_name column_type,column_name

  • table_name represents the name of the table that we want to create.
  • column_name represents the column names that we want in the table.
  • column_type represents the data type of the column.
					MySQL [wordpress]> create table users(email_address varchar(30), password varchar(30), number int);

Query OK, 0 rows affected (0.38 sec)


To confirm that the table has been successfully created, we will use the show tables command to display the list of existing tables in the currently opened database.

					MySQL > show tables;

| Tables             |
| users              |


Those are some basic commands to work with our database.