Create by connecting to the MySQL server and using the following steps: connect to the server, create the database using the CREATE DATABASE statement, and check whether the database is created successfully.
How to create a database in MySQL
The process of creating a MySQL database is very simple and can be completed by following the steps :
Connect to the MySQL server using command line tools or the graphical user interface (GUI). For example, using the command line tool, type the following command:
mysql -u username -p
where username
is your MySQL username and the -p
option prompts you for your password.
Use the CREATE DATABASE
statement to create a database. The syntax is as follows:
CREATE DATABASE database_name;
where database_name
is the name of the database you want to create. For example:
CREATE DATABASE my_database;
Use the SHOW DATABASES
statement to check whether the database has been successfully created.
SHOW DATABASES;
You should see the newly created database in the list.
Other Notes:
The above is the detailed content of How to create a database using mysql. For more information, please follow other related articles on the PHP Chinese website!