To create a new database in MySQL, you can use the CREATE DATABASE statement. Here's the basic syntax:
CREATE DATABASE database_name;
Replace database_name with the desired name for your database. Here's an example:
CREATE DATABASE mydatabase;
If you're using a MySQL client, you can execute this SQL command directly in the SQL console or command line.
Here are the steps for creating a database using the MySQL command line:
1. Open a command prompt or terminal.
2. Login to MySQL using the following command:
mysql -u your_username -p
Replace your_username with your MySQL username. You'll be prompted to enter your MySQL password
3. Once you are logged in, you can create a new database using the CREATE DATABASE statement:
CREATE DATABASE mydatabase;
Replace mydatabase with the desired name for your database.
4. After creating the database, you can switch to it using the USE statement:
USE mydatabase;
Now you've created and selected the new database. You can start creating tables and performing other database operations within this database.