Summary of Permissions
1. Create an account
Grant all privileges on *. * To Z1 @ localhost;
*. * Indicates that you have permissions on all the local databases and tables. You can change the permission to on test. user, and you have permissions on the user table of the test database.
Restrict IP addresses and add passwords
Grant select, insert, update... on test1. * To 'z1' @ 'localhost' identified by 'Password'
You can also use on test. * To 'z1' @ '%' to indicate that you can connect to any host.
2. Grant login permissions to a user, but nothing else can be seen.
Grant usage on *. * To 'z4' @ 'localhost ';
3. view the permissions of a user
Show grants from Z1 @ localhost;
View the permissions of the Z1 user.
4. revoke permissions
Revoke select, insert on *. * From Z2 @ localhost;
5 Security Principles
A. Do not log on with the root account.
B. Except root, no user should have permissions for the MySQL database and user table database.
C. do not grant file, process, or super permissions to accounts other than administrators.