远程连接mysql的“Communications link failure”错误解决方案
2012-10-26 10:18
639 查看
最近忙着做毕设的东西,用到了mysql存储一些系统元数据,在使用系统ip地址连接的时候出现错误,但是使用localhost连接mysql却没有问题。
错误信息:Communications link failure,Last packet sent to the server was 0 ms ago.
最初想到的是授权问题,即授权制定的数据库有远程访问权限。有两种方法:
1)采用改表法
2)授权法
然而授权法根本没有用,而改表法则提示user表中已经有了这条记录。那么这个原因究竟是在哪里呢?经过网上一番查找,才发现原来是mysql配置文件的问题。
修改mysql的配置文件my.cnf(WINDOWS下面应该是my.ini),将bind-address=127.0.0.1这一行注释掉就好了。
错误信息:Communications link failure,Last packet sent to the server was 0 ms ago.
最初想到的是授权问题,即授权制定的数据库有远程访问权限。有两种方法:
1)采用改表法
mysql -u root -p mysql>use mysql; mysql>update user set host = '%' where user = 'ssj'; mysql>select host, user from user;
2)授权法
GRANT ALL PRIVILEGES ON CloudBus.* TO 'ssj'@'%'; //CloudBus是我的数据库名称,ssj是我的mysql用户名 FLUSH PRIVILEGES;
然而授权法根本没有用,而改表法则提示user表中已经有了这条记录。那么这个原因究竟是在哪里呢?经过网上一番查找,才发现原来是mysql配置文件的问题。
修改mysql的配置文件my.cnf(WINDOWS下面应该是my.ini),将bind-address=127.0.0.1这一行注释掉就好了。
相关文章推荐
- 远程连接mysql数据库报“Communications link failure...”错误的解决方法之一
- 远程连接mysql数据库报“Communications link failure...”错误的解决方法之一
- java工程连接远程MySQL数据库报错:Communications link failure due to underlying exception
- mysql-错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
- java工程连接远程MySQL数据库报错:Communications link failure due to underlying exception
- 解决MySQL连接超时Communications link failure due to underlying exception
- 解决mysql连接异常—-com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception
- mysql 5.1超过默认8小时空闲时间解决办法(错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure)
- 解决mysql连接异常—-com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception
- 解决MySQL连接超时Communications link failure due to underlying exception
- 解决MySQL连接超时Communications link failure due to underlying exception
- sqoop连接mysql出现 Communications link failure
- 解决MySQL连接超时Communications link failure due to underlying exception
- 数据库连接错误:Communications link failure due to underlying exception
- 解决Java程序连接mysql数据库出现CommunicationsException: Communications link failure错误的问题
- 解决MySQL连接超时Communications link failure due to underlying exception
- 解决MySQL连接超时Communications link failure due to underlying exception
- MySQL连接超时Communications link failure
- 解决MySQL连接超时Communications link failure due to underlying exception
- mysql远程连接错误1130的解决方案