mysql空用户(user列为空)带来的影响
mysql> create user 'setest'@'%' identified by 'sepwd';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select user, password, host from mysql.user where user="setest";
+--------+-------------------------------------------+------+
| user | password | host |
+--------+-------------------------------------------+------+
| setest | *D916076B3441EFE82B5D01B2ECF5E15DED34B0B3 | % |
+--------+-------------------------------------------+------+
1 row in set (0.00 sec)
mysql> quit
Bye
[root@oracle-test ~]# mysql -usetest -p
Enter password:
ERROR 1045 (28000): Access denied for user 'setest'@'localhost' (using password: YES)
用工具可以远程连接。
解决办法:
mysql> select user,host,password from mysql.user;
+--------+----------------+-------------------------------------------+
| user | host | password |
+--------+----------------+-------------------------------------------+
| root | localhost | 64f6539969715ad7 |
| root | term001 | |
| root | 127.0.0.1 | |
| | localhost | |
| | term001 | |
| setest | % | *D916076B3441EFE82B5D01B2ECF5E15DED34B0B3 |
+--------+----------------+-------------------------------------------+
9 rows in set (0.00 sec)
这里有两个空用户,将这两个空用户删除,mysql> drop user term001; mysql> drop user localhost;然后本地连接就可以了,具体原因可以参照原作者答案。
源地址:http://blog.csdn.net/zbszhangbosen/article/details/7434154
百度白天没有结果,换成Google后,马上找到答案了。