各位大大:
本人做了1个MYSQL数据库,本机连接没有问题,可以读写操作。但是在局域网其他机器上就连接不上,错误如下。
求教!
can not connect to mysql server on 172.16.3.10连接语句为
DBConn = new MySQLConnection(new MySQLConnectionString("172.16.3.10", "database", "root", "666666", 3306).AsString);
DBConn.Open();
本人做了1个MYSQL数据库,本机连接没有问题,可以读写操作。但是在局域网其他机器上就连接不上,错误如下。
求教!
can not connect to mysql server on 172.16.3.10连接语句为
DBConn = new MySQLConnection(new MySQLConnectionString("172.16.3.10", "database", "root", "666666", 3306).AsString);
DBConn.Open();
grant all on *.* to username@'%' identified by 'yourpassword';
显示Query OK,0rows affected(0.00sec)
但是还是连不上,显示同样的错误,"can not connect to mysql server on 172.16.3.10"后面接个10060
zz连接数据库的时候显示Can't connect to MySQL server (10060),基本可以按照以下思路进行排查:
1. 网络不通。
检查能不能ping通。
2. 防火墙设置。
防火墙是否放过mysql的进程,是否屏蔽了mysql的3306端口。
3. mysql的账户设置。
mysql账户是否不允许远程连接。如果无法连接可以尝试以下方法:
mysql -u root -p //登录MySQL
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; //任何远程主机都可以访问数据库
mysql> FLUSH PRIVILEGES; //需要输入次命令使修改生效
mysql> EXIT //退出
也可以通过修改表来实现远程:
mysql -u root -p
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;
[收集]mysql 无法联接故障现象及原因