【IT168 技术文档】 今天不知道怎么了,在windowns 7上安装mysql,就是不成功,后来没有办法去,在http://dev.mysql.com/downloads/mysql/下了个免安装的版本,解压后,用是能用了。
给应用测试的人建立了一个测试的数据库和用户,奇怪的是,在本地登录没事,远程登录,无论如何都报10045(28000)错误。
1 C:\Windows\system32>mysql -uuism -h 172.16.9.43
2 ERROR 1045 (28000): Access denied for user ‘uism’@’172.16.5.20′ (using password:
3 YES)
2 ERROR 1045 (28000): Access denied for user ‘uism’@’172.16.5.20′ (using password:
3 YES)
检查系统的user表,发现结果如下:
1 mysql> select user ,host ,password from user;
2 +——+———–+——————+
3 | user | host | password |
4 +——+———–+——————+
5 | root | localhost | |
6 | root | 127.0.0.1 | |
7 | | localhost | |
8 | uism | localhost | 16cfa8943c7fb191 |
9 | uism | % | |
10 | uims | % | |
11 +——+———–+——————+
12 6 rows in set (0.00 sec)
2 +——+———–+——————+
3 | user | host | password |
4 +——+———–+——————+
5 | root | localhost | |
6 | root | 127.0.0.1 | |
7 | | localhost | |
8 | uism | localhost | 16cfa8943c7fb191 |
9 | uism | % | |
10 | uims | % | |
11 +——+———–+——————+
12 6 rows in set (0.00 sec)
用户在本地登录是好的,远程无论如何都不行,不管给不给密码。查询网络发现,需要将user表中那个用户名为空的用户干掉;
1 mysql> delete from user where user is null;
2 Query OK, 0 rows affected (0.00 sec)
3
4 mysql> delete from user where user =”;
5 Query OK, 1 row affected (0.00 sec)
2 Query OK, 0 rows affected (0.00 sec)
3
4 mysql> delete from user where user =”;
5 Query OK, 1 row affected (0.00 sec)
这里看看,原来这个用户名还不是null,只是一个空字符串,晕倒。
然后,重新更新下权限,
1 mysql> flush privileges;
2 Query OK, 0 rows affected (0.00 sec)
2 Query OK, 0 rows affected (0.00 sec)
再在客户端做链接:
1 C:\Windows\system32>mysql -uuism -h172.16.9.43
2 Welcome to the MySQL monitor. Commands end with ; or \g.
3 Your MySQL connection id is 103
4 Server version: 5.1.47-community MySQL Community Server (GPL)
5
6 Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
7
8 mysql>
2 Welcome to the MySQL monitor. Commands end with ; or \g.
3 Your MySQL connection id is 103
4 Server version: 5.1.47-community MySQL Community Server (GPL)
5
6 Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
7
8 mysql>
Mysql怎么会有这么搞笑的问题,哈哈,而且那个用户的host为%的那个,密码为空,现在变成了远程不需要密码,本地需要密码,囧!