系统环境:
Ubuntu 8.04
MYSQL Server version: 5.0.51a-3ubuntu5 (Ubuntu)不过无意中我们发现了一个问题
ERROR 1045: Access denied for user: 'testmysql@localhost' (Using password: YES)首先root帐户是可以登录的,那我们就使用root登录吧,然后让我们打开user表(所在位置:mysql --> user):
mysql> use mysql;
mysql> select Host,User from user;
+------------+------------------+
| Host | User |
+------------+------------------+
| % | |
| % | testmysql |
| 127.0.0.1 | root |
| localhost | debian-sys-maint |
| localhost | root |
| wpc-laptop | root |
+------------+------------------+
6 rows in set (0.00 sec)原来如此我们好像有一个匿名帐户,因为这个帐户密码是空,会不会和这个帐户有关呢?我一向比较大胆,那就不管那么多了,直接干掉它。
mysql> delete from user where User='';
Query OK, 1 row affected (0.00 sec)
mysql> select Host,User from user;
+------------+------------------+
| Host | User |
+------------+------------------+
| % | testmysql |
| 127.0.0.1 | root |
| localhost | debian-sys-maint |
| localhost | root |
| wpc-laptop | root |
+------------+------------------+
5 rows in set (0.00 sec)那我们再去实验一下,
终于可以登录了,不错不错。
实验成功,那到底是为什么呢?我去网上搜索了一下,没有找到很有用的东西。只能臆断了,估计是系统将非root用户全部作为匿名用户对待了。
本文介绍了在Ubuntu 8.04系统下使用MySQL 5.0.51a版本时遇到的新创建用户无法使用预设密码登录的问题,并通过删除匿名用户解决了该问题。

被折叠的 条评论
为什么被折叠?



