Home  >  Article  >  Database  >  What statement is used to create a database in mysql

What statement is used to create a database in mysql

下次还敢
下次还敢Original
2024-04-05 19:33:151035browse

What statements are used to create a database in MySQL?

To create a database in MySQL, you can use the CREATE DATABASE statement.

Syntax

<code>CREATE DATABASE database_name;</code>

Parameters

  • database_name: The name of the database to be created (identifier).

Example

To create a database named "mydb", you can use the following statement:

<code>CREATE DATABASE mydb;</code>

After executing this statement, The "mydb" database will be created.

Note

  • Database names are case-sensitive.
  • Before creating a new database, you need to connect to the MySQL server. The
  • CREATE DATABASE statement can only be executed by a user with appropriate permissions, such as the CREATE permission.

The above is the detailed content of What statement 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