mysql使用IP地址访问失败

mysql使用IP地址访问失败(ERROR 1045 (28000): Access denied for user ‘root’@‘WIN-JATIACT91UR.localdomain’ (using password: YES))

mysql -h localhost -uroot -p (登录成功)
mysql -h 127.0.0.1 -uroot -p (登录成功)

mysql -h 192.168.11.11 -uroot -p (登录失败)
ERROR 1045 (28000): Access denied for user 'root'@'WIN-JATIACT91UR.localdomain' (using password: YES)
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| ttzo             | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
mysql> update user set host = '%' where user = 'root';
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| ttzo             | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
+------------------+-----------+
5 rows in set (0.00 sec)

刷新权限

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

你可能感兴趣的:(mysql,数据库,java)