1.检查服务器防火墙是否关闭;是否是防火墙导致的;
2.检查网络是否链接的通,检查端口: telnet ip 端口号
3.检查MySQL用户
用命令行进入mysql数据库
C:Saftwaremysqlin>mysql -u root -p
#切换到MySQL数据库下;
mysql> use mysql;
Database changed
mysql> update user set host = '%' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3 Changed: 0 Warnings: 0
#查询数据库MySQL的用户和配置
mysql> select host,user from user;
+------+---------------+
| host | user |
+------+---------------+
| % | mysql.session |
| % | mysql.sys |
| % | root |
+------+---------------+
3 rows in set (0.00 sec)
#用户授权可以远程链接
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
#提交事务
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
最重要的一点,退出数据库之后,需要重新启动MySQL服务,否则,是不生效的,是无法远程链接得上MySQL数据库的;
重启服务命令: net start mysql;
停止服务命令: net stop mysql;