Reputation: 76
I am new to MySQL, and I have created a user called magento as described in the table below. Now I am not able to delete that user!
mysql> SELECT User, Host, Password FROM mysql.user;
+------------------+-------------------+-------------------------------------------+
| User | Host | Password |
+------------------+-------------------+-------------------------------------------+
| root | localhost | *F4F8C81F12A316D6884269A228966F1E5763E16F |
| root | mgaber-virtualbox | *F4F8C81F12A316D6884269A228966F1E5763E16F |
| root | 127.0.0.1 | *F4F8C81F12A316D6884269A228966F1E5763E16F |
| root | ::1 | *F4F8C81F12A316D6884269A228966F1E5763E16F |
| debian-sys-maint | localhost | *63EDFEF710866BF1C20505D01DCEFBAA246750BC |
| ‘magento’ | ’localhost’ | |
+------------------+-------------------+-------------------------------------------+
I have used the below commands.
mysql> drop user ‘magento’;
ERROR 1396 (HY000): Operation DROP USER failed for '‘magento’'@'%'
mysql> drop user ‘magento’@'localhost';
ERROR 1396 (HY000): Operation DROP USER failed for '‘magento’'@'localhost'
Both are not working.
How can I fix this problem?
Upvotes: 1
Views: 2364
Reputation: 1
You can drop the user by escaping the single quotes as shown below according to the doc:
DROP USER '\'magento\''@'\'localhost\'';
DROP USER '''magento'''@'''localhost''';
Or, you can also drop the user with double quotes quotes as shown below:
DROP USER "'magento'"@"'localhost'";
Upvotes: 0
Reputation: 37233
Change this
mysql> drop user ‘magento’;
to
drop user 'magento'@'localhost';
You have to use the right quotes '
and not ‘
.
Or use this:
DELETE FROM users where user = 'magento'
Upvotes: 2