Create a database using Mysqladmin
With a normal user, you may need specific permissions to create or delete a MySQL database.
So here we are using the root user login, the root user has the highest privileges, you can use the MySQL mysqladmin command to create a database.
Instance
The following command simply demonstrates the process of creating a database with the data name tutorials:
[[Email protected]]# mysqladmin-u root-p Create Tutorialsenter password:******
After successful execution of the above command, MySQL database tutorials will be created.
creating a database using PHP scripts
PHP uses the Mysql_query function to create or delete MySQL databases.
The function has two parameters, returns TRUE on successful execution, or FALSE.
Grammar
BOOL mysql_query (SQL, connection);
| Parameters |
Description |
| Sql |
Necessary. Specifies the SQL query to send. Note: The query string should not end with a semicolon. |
| Connection |
Optional. Specifies the SQL connection identifier. If not specified, the previous open connection is used. |
Instance
The following example demonstrates the use of PHP to create a database:
Original address: http://www.manongjc.com/mysql/mysql_create_database.html
Related reading:
MySQL operator Daquan, precedence, and example explanation
4 Examples of MySQL annotations
MySQL most important commands for detailed sharing
How the MySQL console ends the current write-wrong SQL
MySQL keyword is case insensitive
MySQL uses the status command to test/determine if the database is connected
MySQL command line login instance Demo
MySQL two ways to create a database