Method to delete mysql user name: 1. Use drop to delete, the syntax is [drop user XXX; delete existing user]; 2. Use delete to delete, the syntax is [delete from user where user='XXX ' and host='..'].
Related learning recommendations: mysql database
Method to delete mysql username:
1. Use drop to delete
drop user XXX;删除已存在的用户,默认删除的是'XXX'@'%'这个用户
If there are other users such as 'XXX'@'localhost', etc. , will not be deleted together. If you want to delete 'XXX'@'localhost', you need to add host when using drop to delete, that is, drop user 'XXX'@'localhost'.
2. Use delete to delete
delete from user where user='XXX' and host='localhost';其中XXX为用户名,localhost为主机名
3. Difference
drop will not only delete the data in the user table, but also delete the contents of other permission tables.
Delete only deletes the contents of the user table, so after using delete to delete a user, you need to execute FLUSH PRIVILEGES; to refresh the permissions, otherwise an error will be reported the next time you use the create statement to create a user.
The above is the detailed content of How to delete mysql username. For more information, please follow other related articles on the PHP Chinese website!