CREATE DATABASE statement in MySQL is used to create a new database. Here’s an example of how to use the
CREATE DATABASE statement to create a new database named “example_database”:
CREATE DATABASE example_database;
This simple statement will create a new database named “example_database” with default settings. By default, the new database will use the default character set and collation for the MySQL server.
If you want to specify a different character set and collation for the new database, you can do so using the
CHARACTER SET and
COLLATE options. For example, to create the “example_database” with UTF-8 character set and utf8_general_ci collation, you can use the following statement:
CREATE DATABASE example_database CHARACTER SET utf8 COLLATE utf8_general_ci;
Please note that you need appropriate privileges to execute the
CREATE DATABASE statement. Typically, the
CREATE privilege on the MySQL server is required to create databases.