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