Create database User Add permissions
category |
Detailed Solution |
Basic syntax |
Grant permissions on library. Table to ' user ' @ ' host ' identified by ' password '; |
Example |
Grant SELECT, insert on test.* to ' liwenkai ' @ ' localhost ' identified by ' 4311 '; |
Example description |
Give the Liwenkai user permission to connect all tables in the test library natively. These tables of operations have query and write permissions |
Note: You can add multiple permissions for one user.
Delete permissions
category |
Detailed Solution |
Basic syntax |
Revoke permissions on library. Table from ' user ' @ ' host '; |
Example |
Revoke SELECT, insert on test.* to ' liwenkai ' @ ' localhost ' identified by ' 4311 '; |
Example description |
Give the Liwenkai user permission to connect all tables in the test library natively. These tables of operations have query and write permissions |
Parameter description
symbols |
Description |
Grant All |
After Grant, all instructions are given to grant all permissions |
Revoke all |
After revoke all instructions to remove all permissions |
Permissions on . |
. The permissions that are given to all tables in all libraries |
' User ' @ ' host ' |
If the host is%. Hosts from any source can use this user to access |
Create database user Liwenkai with all Select/insert permissions on the test database
Example: Increasing permissions
Mysql> Grant SELECT, insert on test.* to ' liwenkai ' @ ' localhost ' identified by ' 4311 ';
Query OK, 0 rows Affected (0.00 sec)
Example: Removing Permissions
Mysql> revoke insert on test.* from ' Liwenkai ' @ ' localhost ';
Query OK, 0 rows affected (0.30 sec)
Note:
Some of the above statements use less. You can set the mastery level of the knowledge point to understand the level.
More often, there are more permissions to set up, and people tend to remember specific commands. More often, people use specialized tools to manipulate permissions.
Transferred from: http://www.php.cn/code/4711.html
MySQL CREATE database user, permission settings