Add/Remove a Mysql user

Grant all privileges on a database to a single user:

mysql> CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'new_password';

mysql> GRANT ALL ON my_db.* TO 'new_user'@'localhost';


mysql> GRANT ALL PRIVILEGES ON database_name.* to 'new_user'@'localhost' IDENTIFIED BY 'password';

Remove a USer from Mysql

Review a List of MySQL Users

mysql> SELECT User,Host FROM mysql.user;

Remove a MySQL User
To remove a user from MySQL, we again use the DROP command.

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:

mysql> DROP USER 'testuser'@'localhost';

If a user of the name testuser does not exist, then you’ll receive this error:

mysql> ERROR 1396 (HY000): Operation DROP USER failed for 'testuser'@'localhost'