MySQL revokes permissions and deletes user bitsCN.com
Cancel permissions and delete users in MySQL
As the database administrator, since users can be created and authorized, users can also be revoked and deleted. To cancel a user's permissions, you can use the REVOKE statement. The syntax format of this statement is as follows:
Revoke privileges (columns) on what from user ;
Here, privileges is the permission to be canceled, and user is the user name to be revoked.
Example:
The following code cancels all permissions of sss users.
mysql> revoke all on *.* from sss@localhost ;Query OK, 0 rows affected (0.00 sec)
The REVOKE statement can only cancel user permissions, but cannot delete users. Even if you cancel all permissions, you can still connect to the server. To completely DELETE a user, you must use the DELETE statement to DELETE the user's records from the user table in the MySQL database. The syntax format of this statement is as follows:
Delete from user where user = "user_name" and host = "host_name" ;
Use DELETE to DELETE the sss user. the code is as follows:
mysql> use mysqlDatabase changedmysql> delete from user where user='sss' and host='localhost' ;mysql>flush privileges ;Query OK, 1 row affected (0.02 sec)
Delete is used to delete users. flush tells the server to reload the authorization table.
BitsCN.com