User Management
1. Query users
Use user;
Select Host,user from user;
2. Create user
Create user hkx001 identified by ' hkx001 ';
Create user [email protected] identified by ' hkx001 ';
Note: [User]@[ip] indicates that the user client must have an IP address of [IP] to connect to the server. [IP] supports fuzzy matching%_.
3. Modify User Password
Set password for hkx001= ' hkx002 ';
4. Renaming users
Rename user hkx001 to hkx002;
5. Delete users
Drop user hkx001;
Rights Management
1. Query permission
Show grants for hkx001;
2. Giving permission
Grant SELECT on world.* to hkx001;
3. Reclaim Permissions
Revoke select on world.* from hkx001;
4. Refresh Permissions
Flush privileges;
Note: Execute this command after modifying the user's permissions.
5. Permission table
Permissions |
Description |
All |
|
Alter |
|
Alter routine |
Use ALTER procedure and drop procedure |
Create |
|
Create routine |
Using the CREATE PROCEDURE |
Create temporary tables |
Using the Create temporary table |
Create user |
|
CREATE view |
|
Delete |
|
Drop |
|
Execute |
Using call and stored procedures |
File |
Using SELECT INTO outfile and load data infile |
Grant option |
You can use GRANT and revoke |
Index |
You can use the CREATE INDEX and drop index |
Insert |
|
Lock tables |
Lock table |
Process |
Use Show full processlist |
Reload |
Using flush |
Replication Client |
Server location Access |
Replocation slave |
Used by replication slaves |
Select |
|
Show databases |
|
Show view |
|
Shutdown |
Use mysqladmin shutdown to turn off MySQL |
Super |
|
Update |
|
Usage |
No access rights |
MySQL User management