Steps to DROP MYSQL users manually

kumkumsharma

Administrator
Staff member
If you want to DROP MySQL users manually then you can check this article. Sometime we need to DROP users to resolve the issue then here is the solution:

You can run below command to DROP user:

Code:
mysql mysql -e "DROP user '$USER'@'$HOST';"
In this command you have to replace $USER with your username and $HOST to your host name. Generally you have to use “localhost” as hostname. Also you have to use single-quotes with user and hostname.

You can check below example:

Code:
mysql mysql -e "DROP user 'hoststud'@'localhost';"
To delete all the users from your account you can use below command:

Code:
mysql mysql -e "delete from mysql.user where User like 'hoststud%';"
From this table you can remove all the users from your database table:

Code:
mysql mysql -e "delete from mysql.db where User like ‘hoststud%';"
 
Top