II. Grant Permission to a MySQL User on Linux via Command Line
III. Remove Permissions for a MySQL User on Linux via Command Line
IV. Remove a MySQL User on Linux via Command Line
MySQL via Command Line 101: Basic Database Interaction
- These instructions are intended for removing a MySQL user on Linux via the command line
- I’ll be working from a Liquid Web Core Managed CentOS 6.5 server, and I’ll be logged in as root.
First we’ll login to the MySQL server from the command line with the following command:
mysql -u root -p
In this case, I’ve specified the user
If you need to change your root (or any other) password in the database, then follow this tutorial on changing a password for MySQL via the command line.
You should now be at a MySQL prompt that looks very similar to this:
If you haven’t yet created a MySQL user, please refer to our tutorial on creating a MySQL user.
Viewing a full list of MySQL users, including the host they’re associated with, can be done with the following select statement:
SELECT User,Host FROM mysql.user;
To remove a user from MySQL, we again use the
It only takes one simple command to delete a user in MySQL, but BEWARE; dropping a user can not be undone! The command is as follows:
DROP USER 'testuser'@'localhost';
If a user of the name
ERROR 1396 (HY000): Operation DROP USER failed for 'testuser'@'localhost'
Refer to the
Tagged with: cli • command line • core managed • database • drop • linux • mysql • select • user