估计还是授予权的问题。3. 权限的问题 ,mysql 的权限设置中用户的账号由 username@hostname 两部分组成, aaaa@localhost 和 [email protected] 对MYSQL来说并不是同一个用户授权!,先试着 grant all on *.* to root@%; 然后再连一下试试ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
查询mysql库里user表对应的host是否包含你电脑的IP(%为不限制IP允许远程连接)。
mysql> use mysql Database changed mysql> select host,user from user; +-----------+-------+ | host | user | +-----------+-------+ | % | model | | % | scot | | localhost | root | +-----------+-------+ 3 rows in set (0.00 sec) 看看user对应的host
楼上几位可能误会的意思了,我是两台服务器A和B,平时运行正常,也就是权限没问题;而当我用自己的电脑C,去远程桌面连接B,这时,A就连不上B的MYSQL服务器了用户 主机 类型 权限 授权 操作 root % 全局 ALL PRIVILEGES 是 root localhost 全局 ALL PRIVILEGES 是
你用远程桌面链接?你试试用你的客户端在命令行链接后A就能不能连上B的MYSQL服务器
用实时桌面工具(如VNC)连呢?
怎么样用命令连接呢?我用的就是windows自带的,“附件”——“通讯”——“远程桌面”
我的意思是你用mysql客户端链接 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.36-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 你的问题可能是远程桌面链接限制了其他链接
在命令行输入:mysql -host IP -uroot -p 回车 password 回车 看能不能连接上?IP是你要连接的机器的IP。
grant all on *.* to root@%;
然后再连一下试试ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Database changed
mysql> select host,user from user;
+-----------+-------+
| host | user |
+-----------+-------+
| % | model |
| % | scot |
| localhost | root |
+-----------+-------+
3 rows in set (0.00 sec)
看看user对应的host
root % 全局 ALL PRIVILEGES 是
root localhost 全局 ALL PRIVILEGES 是
用实时桌面工具(如VNC)连呢?
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.36-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
你的问题可能是远程桌面链接限制了其他链接
password 回车
看能不能连接上?IP是你要连接的机器的IP。