What is the method for mysql to delete a user?
This article mainly introduces what is the method of deleting users by mysql, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
There are two ways for mysql to delete users: one is to use the drop statement, and the other is to use the delete statement.
Drop
Drop user XXX
Delete existing users, the default is' XXX'@'%' this user, 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, that is, drop user' XXX'@'localhost' when you use drop to delete.
Delete
Delete from user where user='XXX' and host='localhost'
Where XXX is the user name and localhost hostname.
Difference
Drop deletes not only the data in the user table, but also the contents of other permissions tables. Delete only deletes the contents of the user table, so you need to perform FLUSH PRIVILEGES; refresh permissions after deleting a user using delete, otherwise an error will be reported the next time you create a user using the create statement.
!
Thank you for reading this article carefully. I hope the editor will share what the method of deleting users from mysql is helpful to everyone. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you have any problems. Detailed solutions are waiting for you to learn!