What are the MySQL permission control statements?
What are the MySQL permission control statements? In order to give you a better understanding of MySQL access control statements, the editor summarizes the following, let's look down together.
MySQ permission control statement
1. Log in to the MySQL server using your root account:
Mysql-u root-pmypass
two。 Switch to the mysql database instance:
Use mysql
3. View the user table:
Select host, user, password from user
4. Create a user "yang" with a password of "yangpass" that is only allowed to log in from this machine:
Create user 'yang'@'localhost' identified by' yangpass'
5. Delete a native login user named "yang":
Drop user 'yang'@'localhost'
6. Create a user "yang" that allows login from any host with a password of "yangpass":
Create user 'yang'@'%' identified by' yangpass'
7. Change the password of the user "yang" who is allowed to log in from any host, the new password is "yan":
Set password for 'yang'@'%' = password (' yan')
8. Grant all permissions to yang_test 's library to a user named "yang" who is allowed to log in from any host:
Grant all privileges on yang_test.* to 'yang'@ "%"
9. Refresh permissions to make permission changes take effect:
Flush privileges
10. Create a user "remote" that allows login from any host with a password of "app":
Create user 'remote'@'%' identifed by' app'
11. The "remote" user grants CRUD permissions to the "t_weapon" table on the library "yang_test":
Grant select, delete, update, insert on yang_test.t_weapon to 'remote'
twelve。 Revoke all permissions of user "yang" on the "yang_test" library:
Revoke all privileges on yang_test.* from 'yang'@'%'
After reading the above, do you have a general understanding of MySQL access control statements? If you want to know more, please follow other related articles!