Home >Database >Mysql Tutorial >What command is used to create a database in mysql

What command is used to create a database in mysql

下次还敢
下次还敢Original
2024-05-01 21:06:331174browse

The command to create a database in MySQL is CREATE DATABASE database_name;. You need to specify the name of the database to be created. For example, to create a database named "my_database", use CREATE DATABASE my_database;.

What command is used to create a database in mysql

Commands to create a database in MySQL

To create a database in MySQL, you need to use the following commands:

<code>CREATE DATABASE database_name;</code>

Command syntax:

  • CREATE DATABASE: Command to create a database.
  • database_name: The name of the database to be created.

Example:

To create a database named "my_database", you can use the following command:

<code>CREATE DATABASE my_database;</code>

Execute Command:

  1. Open the MySQL command line client (such as MySQL Workbench or MySQL Shell).
  2. At the command prompt, enter the following command:
<code>CREATE DATABASE my_database;</code>
  1. Press Enter to execute the command.

If the command is executed successfully, a database named "my_database" will be created.

The above is the detailed content of What command is used to create a database in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn