Remove a MySQL User on Linux via Command Line
I’ll be performing from Liquid net Core Managed CentOS half dozen.5 server, and l’ll be logged in as root.
Login to MySQL:
First, we’ll login to the MySQL server from the instruction with the following command:
In this case, I’ve nominative the user root with the -u flag, so used the -p flag so MySQL prompts for a word. Enter your current word to complete the login.
If you wish to vary your root (or any other) word within the info, then follow this tutorial on ever-changing a word for MySQL via the statement.
You should currently be at a MySQL prompt that appears terribly like this:
If you haven’t nonetheless created a MySQL user, please sit down with our tutorial on making a MySQL user.
View an inventory of MySQL Users
Viewing a full list of MySQL users, as well as the host they’re related to, is finished the following choose statement:
Remove a MySQL User
To remove a user from MySQL, we once more use the DROP command.
It solely takes one straightforward command to delete a user in MySQL, however BEWARE; dropping a user can’t be undone! The command is as follows:
If a user of the name testuser does not exist, then you’ll receive this error:
Refer to the View a List of MySQL Users section above if you receive the above error, and double check the username and host.