I've just installed MySQL Community server (5.5.8) on Mac OS X 10.6.6.
我刚刚在Mac OS X 10.6.6上安装了MySQL Community server(5.5.8)。
I've been following the rules for a secure install (assign password to root, delete anonymous accounts, etc), however, there is one user account which I can't DROP:
我一直遵循安全安装的规则(为root用户分配密码、删除匿名帐户等),但是有一个用户帐户我不能删除:
mysql> select host, user from mysql.user;
+--------------------------------+------+
| host | user |
+--------------------------------+------+
| 127.0.0.1 | root |
| ::1 | root |
| My-Computer-Hostname.local | |
| My-Computer-Hostname.local | root |
| localhost | root |
| localhost | web |
+--------------------------------+------+
6 rows in set (0.00 sec)
mysql> drop user ''@'My-Computer-Hostname.local';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host, user from mysql.user;
+--------------------------------+------+
| host | user |
+--------------------------------+------+
| 127.0.0.1 | root |
| ::1 | root |
| My-Computer-Hostname.local | |
| My-Computer-Hostname.local | root |
| localhost | root |
| localhost | web |
+--------------------------------+------+
6 rows in set (0.00 sec)
mysql>
As you can see, MySQL reports no errors when executing the DROP USER command, but doesn't actually delete the user!
如您所见,MySQL在执行DROP USER命令时没有报告错误,但实际上并没有删除用户!
I've tried also deleting the user from within phpMyAdmin (3.3.9) and that produced the same results (i.e. reported success, no error messages, user not deleted).
我还尝试从phpadmin(3.3.9)中删除用户,结果是一样的(例如,报告成功,没有错误消息,用户未被删除)。
I've researched this and some people suggest that GRANT may be blocking the DROP USER command, however, the user has no GRANT privileges:
我研究过这个问题,有些人认为GRANT可能会阻止DROP USER命令,但是,用户没有GRANT权限:
mysql> SHOW GRANTS FOR ''@'My-Computer-Hostname.local';
+-----------------------------------------------------------+
| Grants for @my-computer-hostname.local |
+-----------------------------------------------------------+
| GRANT USAGE ON *.* TO ''@'my-computer-hostname.local' |
+-----------------------------------------------------------+
1 row in set (0.00 sec)
mysql> REVOKE GRANT OPTION ON *.* FROM ''@'My-Computer-Hostname.local';
ERROR 1141 (42000): There is no such grant defined for user '' on host 'my-computer-hostname.local'
I tried dropping the user again after that but it didn't drop/delete the user either.
之后我尝试再次删除用户,但它也没有删除用户。
I've checked my MySQl error logs and there's nothing unusual in there.
我检查了MySQl错误日志,没有什么异常。
The MySQL manual suggests that it is possible to delete all anonymous accounts, so why can't I delete this one?
MySQL手册建议可以删除所有的匿名帐户,为什么我不能删除这个呢?
4 个解决方案
#1
4
This is a known bug due to your uppercase characters: http://bugs.mysql.com/bug.php?id=62255
这是一个已知的bug,因为您的大写字符是:http://bugs.mysql.com/bug.php?
Use the suggestion from user douger as a workaround
使用用户douger的建议作为解决方案
#2
7
Or, to delete just the anonymous one and not the root as well:
或者,只删除匿名的,而不删除根:
mysql> DELETE FROM mysql.user WHERE User='' AND Host='my-computer-hostname.local';
mysql >删除从mysql。用户,其中user = " AND Host='my-computer-hostname.local';
Worked for me on 5.1.57.
在5.1.57年为我工作。
#3
2
You can still delete the records from the user table:
您仍然可以从用户表中删除记录:
mysql> DELETE FROM user WHERE host='my-computer-hostname.local';
Query OK, 2 rows affected (0.00 sec)
mysql>从用户中删除,其中主机='my-computer- hostnamees.local ';查询OK,受影响的2行(0.00秒)
This method was used prior to MySQL 4.1...
此方法在MySQL 4.1之前使用。
#4
0
MySQL includes an anonymous user account that allows anyone to connect into the MySQL server without having a user account. This is meant only for testing, and should be removed before the database server is put into a production environment.
MySQL包含一个匿名用户帐户,允许任何人在没有用户帐户的情况下连接到MySQL服务器。这仅用于测试,在将数据库服务器放入生产环境之前应该删除。
Run the following SQL script against the MySQL server to remove the anonymous user account:
对MySQL服务器运行以下SQL脚本,删除匿名用户帐户:
DELETE FROM mysql.user WHERE User='';
After making changes to permissions/user accounts, make sure you flush the provilege tables using the following command:
在对权限/用户帐户进行更改后,请确保使用以下命令刷新proviencetables:
FLUSH PRIVILEGES;
#1
4
This is a known bug due to your uppercase characters: http://bugs.mysql.com/bug.php?id=62255
这是一个已知的bug,因为您的大写字符是:http://bugs.mysql.com/bug.php?
Use the suggestion from user douger as a workaround
使用用户douger的建议作为解决方案
#2
7
Or, to delete just the anonymous one and not the root as well:
或者,只删除匿名的,而不删除根:
mysql> DELETE FROM mysql.user WHERE User='' AND Host='my-computer-hostname.local';
mysql >删除从mysql。用户,其中user = " AND Host='my-computer-hostname.local';
Worked for me on 5.1.57.
在5.1.57年为我工作。
#3
2
You can still delete the records from the user table:
您仍然可以从用户表中删除记录:
mysql> DELETE FROM user WHERE host='my-computer-hostname.local';
Query OK, 2 rows affected (0.00 sec)
mysql>从用户中删除,其中主机='my-computer- hostnamees.local ';查询OK,受影响的2行(0.00秒)
This method was used prior to MySQL 4.1...
此方法在MySQL 4.1之前使用。
#4
0
MySQL includes an anonymous user account that allows anyone to connect into the MySQL server without having a user account. This is meant only for testing, and should be removed before the database server is put into a production environment.
MySQL包含一个匿名用户帐户,允许任何人在没有用户帐户的情况下连接到MySQL服务器。这仅用于测试,在将数据库服务器放入生产环境之前应该删除。
Run the following SQL script against the MySQL server to remove the anonymous user account:
对MySQL服务器运行以下SQL脚本,删除匿名用户帐户:
DELETE FROM mysql.user WHERE User='';
After making changes to permissions/user accounts, make sure you flush the provilege tables using the following command:
在对权限/用户帐户进行更改后,请确保使用以下命令刷新proviencetables:
FLUSH PRIVILEGES;