in Projects, Programming, Technology

How to Delete a MySQL User Account

This is the simplest way to delete (drop) a user from your MySQL database.

DROP USER IF EXISTS username

The DROP USER command was added in MySQL 5.7. In earlier versions you need to modify the grant tables directly. For example, using INSERTUPDATE, or DELETE statements. Use the FLUSH PRIVILEGES statement to make your changes take effect (otherwise a server restart is required).

mysql> delete from user where user='username';
mysql> FLUSH PRIVILEGES;

What are MySQL users?

Just like software applications require an username and password for each human user, databases implement authentication in a similar way. With databases, the user accounts most often represent the application. For example a database administrator might create an database user account called “wordpress” for use by the WordPress application. The WordPress application uses the one database user account on behalf of all human users.

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.