Question
How can a MySQL user be dropped manually?
Answer
The easiest way to perform this is via the MySQL command line.
Drop a Single User
- Connect to your server using SSH as the
rootuser. - Drop the user from the mysql user database:
# mysql mysql -e "DROP user '$USER'@'$HOST';"
CPANEL_WARN: Be sure to replace $USER with the appropriate user and $HOST with the appropriate host. For the host, this will generally be "localhost". For example:
mysql mysql -e "DROP user 'cptech'@'localhost';"
Drop All Users for One Account
- Connect to your server using SSH as the
rootuser. - Remove the users from the mysql
usertable first:
# mysql mysql -e "delete from mysql.user where User like '$USER%';"
- Remove the users from the mysql
dbtable:
# mysql mysql -e "delete from mysql.db where User like '$USER%';"
CPANEL_WARN: Be sure to replace $USER with the appropriate user and preserve the percent sign. For example:
mysql mysql -e "delete from mysql.user where User like 'cptech%';"
Comments
0 comments
Article is closed for comments.