原因:MySQL默认是没有开启远程连接权限,所以无法使用IP地址连接
方法:授予MySQL远程连接权限
1.在MySQL的bin目录下,打开cmd窗口;
2.登录MySQL:mysql -uroot -p
3.grant all privileges on *.* to '用户名'@'IP地址' identified by '密码';(给特定ip授权)
eg:grant all privileges on *.* to 'root'@'IP地址' identified by '密码';
grant all privileges on *.* to root@"%" identified by '密码' with grant option; (任意ip都能远程连接)
eg:grant all privileges on *.* to root@"%" identified by 'root' with grant option;
4.刷新;
flush privileges;
5.重启MySQL服务。