To create a new database, use the following syntax:
CREATE DATABASE database_name;
database_name
: The name of the database you want to create. It must be unique within the MySQL server.Here’s an example where we create a database named store_db
:
CREATE DATABASE store_db;
store_db
.Once the database is created, you can start using it by selecting it with the USE
statement:
USE store_db;
store_db
database, and you can now create tables and add data to it.Creating a database in MySQL is a simple process that forms the foundation for organizing and managing your data. By using the CREATE DATABASE
statement, you can create a new database and begin adding tables to store your data. Make sure to choose a descriptive and unique name for your database to maintain organization in your server.