web123456

Two ways to delete users in mysql

        drop

drop user XXX; Delete existing users, the default user is 'XXX'@'%'. If there are other users such as 'XXX'@'localhost', etc., they will not be deleted together. If you want to delete 'XXX'@'localhost', you need to add host when using drop delete, drop user 'XXX'@'localhost'.

        delete

delete from user where user='XXX' and host='localhost'; where XXX is the user name and localhost is the host name.

the 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 content in the user table, so after using delete to delete the user, you need to execute FLUSH PRIVILEGES; refresh the permissions, otherwise the next time you use the create statement to create the userReport an error