Introduction
There are times where you may need to DROP a MySQL user manually to address an issue or correct a problem caused by lingering users in the MySQL.user table.
Procedure
The easiest way to perform this is via the MySQL command line:
mysql mysql -e "DROP user '$USER'@'$HOST';"
Be sure to replace $USER with the appropriate user and $HOST with the appropriate host. For the host, this will generally be "localhost". Additionally, be sure to leave the (') single-quotes around the user and the host.
For example:
mysql mysql -e "DROP user 'cptech'@'localhost';"
If you need to perform this operation for all the users in an account you may use this command:
mysql mysql -e "delete from mysql.user where User like 'cptech%';"
And this command to remove them from the db
table:
For more details, you may refer to MySQL's official documentation here.