You can use the following statement to create a database-
CREATE DATABASE databaseName;
CREATE DATABASE STUDENT
If we wish to access and use a specific database, we can use the following query -
mysql> USE databaseName Database changed
USE STUDENT
The "USE" statement does not require a semicolon. This is similar to the "QUIT" statement. Even using a semicolon doesn't hurt.
We can create and use our own database, but before doing so, we need MySQL administrator permissions.
MySQL administrator can execute the command as shown below to provide permissions -
mysql> GRANT ALL ON tableName.* TO ‘your_mysql_name’@’your_client_host’;
Here, "your_mysql_name" refers to the MySQL username assigned to the user.
"your_client_host" refers to the host where the user connects to the server.
The above is the detailed content of Create and select a MySQL database. For more information, please follow other related articles on the PHP Chinese website!