1. Create a user
CREATE user username @ ' IP address ' identified by ' password ';
CREATE user username @ '% ' identified by ' password ';
ps:% indicates that all ID addresses can connect to the database, and the IP address indicates that only this IP address can connect to the database
**CREATE USER [email protected]‘%‘ identified by ‘123456‘;**
2. User authorization
2.1 Rights Assignment
GRANT permission 1, permission 2 .... on database name. To user name @IP address or%;
All databases are used . * All permissions are privileges with all or all
PS: Use flush privileges to refresh after assigning permissions
GRANT select,insert,update,delete on blog. TO [email protected]‘%‘;
Flush Privileges
2.2. View Permissions
- SHOW GRANTS for user name @ip address
*' SHOW GRANTS for [email protected] '%; ' * *
2.3. Revoke Permissions
REVOKE permissions 1, Permissions 2 ... on database name. * From user name @IP address or%;
*' REVOKE select,update on blog. From [email protected] '%; ' *
Flush Privileges
2.4. Create and authorize a step &&&&&&&&&&&&& use this ...?
GRANT permissions 1, Permissions 2 ... on database name. * To User name @ip address identified by ' password ';
*GRANT all on blog. to [email protected] '% ' identified by ' 123456 '; * *
Flush privileges Refresh a bit
MySQL database user creation, permission assignment, deletion, etc.