Difference between revisions of "How to Drop a User in MySQL"
From Brian Nelson Ramblings
(→Find the users accounts to remove) |
|||
Line 24: | Line 24: | ||
+-----------+----------------------+ | +-----------+----------------------+ | ||
− | ==Now lets remove the wordpress user from MySQL.== | + | ===Now lets remove the wordpress user from MySQL.=== |
Once logged into mysql as root run the following: | Once logged into mysql as root run the following: |
Latest revision as of 20:47, 16 May 2014
How to Drop a User in MySQL
Adding a user is pretty simple, but they never tell you how to remove a user from the system.
After removing an application from the server you will want to remove that user from MySQL as well.
Find the users accounts to remove
select user,host from mysql.user;
Output:
mysql> select user,host from mysql.user; +-----------+----------------------+ | user | host | +-----------+----------------------+ | brian | % | | root | 127.0.0.1 | | wordpress | 127.0.0.1 | | root | ::1 | | brian | localhost | | root | localhost | | wordpress | localhost | +-----------+----------------------+
Now lets remove the wordpress user from MySQL.
Once logged into mysql as root run the following:
revoke all privileges, grant option from 'wordpress'@'127.0.0.1'; revoke all privileges, grant option from 'wordpress'@'localhost'; drop user 'wordpress'@'127.0.0.1'; drop user 'wordpress'@'localhost';