Home  >  Article  >  Database  >  Create a database using MySQL database (2)

Create a database using MySQL database (2)

黄舟
黄舟Original
2016-12-27 17:18:251227browse

Use the CREATE database statement to complete the creation of the database. The format of the creation command is as follows:

CREATE database database name [other options];

For example, we need to create a database named samp_db Database, execute the following command on the command line:

CREATE database samp_db character set gbk;

In order to facilitate the display of Chinese in the command prompt, use character set gbk to encode the database character when creating Specified as gbk. When the creation is successful, you will get the response Query OK, 1 row affected(0.02 sec).

Note: The MySQL statement ends with a semicolon (;). If you do not add a semicolon at the end of the statement, the command prompt will prompt you to continue input with -> (there are some exceptions, but add The semicolon is definitely correct);

Tips: You can use the show databases; command to see which databases have been created.

The above is the content of creating a database using MySQL database (2). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


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