删除MySQL中的用户无法正常工作

时间:2014-04-27 14:16:07

标签: mysql terminal

我是MySQL的新用户,我创建了一个名为magento的用户,如下表所示。现在我无法删除该用户!

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’       |                                           |
+------------------+-------------------+-------------------------------------------+

我使用了以下命令。

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'

两者都不起作用。

如何解决此问题?

1 个答案:

答案 0 :(得分:1)

更改此

mysql> drop user ‘magento’;

drop user 'magento'@'localhost';

您必须使用正确的引号'而不是

或者使用它:

 DELETE FROM users where user = 'magento'

check this