Difference between DROP USER and deleting row from mysql.user table

I have a database with hundreds of active connections at any given time. When I use the SQL DROP USER statement to delete a user account, it takes ~ 4 seconds, during which all other connections have the status "Permission Check". This means that to remove 1000 users, I will actually lock the database for most of 4000 seconds, which is unacceptable. However, I notice that deleting the user row from the mysql.users table is instantaneous.

Deletes a row from mysql.users kosher? What are the disadvantages compared to using DROP USER? Do I leave stale strings elsewhere? Are there distribution problems? Most likely, I will have to go along this route, but I want to know what else needs to be done for cleaning.

+8
sql mysql sql-drop
source share
1 answer

Depends on your version of MySQL

Disable user in MySQL <= v5.0 only the user record is deleted, but not privileges. MySQL >= v5.0.2 does both at the same time.

You can also transfer multiple users.

+3
source share

All Articles