Home > Database > Mysql Tutorial > Grant all permissions to database to MySQL user?

Grant all permissions to database to MySQL user?

WBOY
Release: 2023-09-10 10:29:02
forward
921 people have browsed it

Grant all permissions to database to MySQL user?

First, use the CREATE command to create a user and password. The syntax is as follows.

CREATE USER 'yourUserName'@'localhost' IDENTIFIED BY 'yourPassword';
Copy after login

The syntax to grant all permissions to a specific database to a user is as follows.

GRANT ALL PRIVILEGES ON yourDatabaseName . * TO 'yourUserName'@'localhost';
Copy after login

Now you can implement the above syntax to create a user and grant all permissions. The query to create a user is as follows.

mysql> create user 'Adam Smith'@'localhost' IDENTIFIED BY 'Adam123456';
Query OK, 0 rows affected (0.29 sec)
Copy after login

Now, grant all permissions to the user. The query is as follows.

mysql> GRANT ALL PRIVILEGES ON test . * TO 'Adam Smith'@'localhost';
Query OK, 0 rows affected (0.19 sec)
Copy after login

The above is the detailed content of Grant all permissions to database to MySQL user?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template