6

连接Ubuntu系统服务器Mysql出错(错误:10061)/Jdbc连接远程数据库出错(java.net.Conn...

 3 years ago
source link: https://blog.csdn.net/ljphhj/article/details/20961247
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

连接Ubuntu系统服务器Mysql出错(错误:10061)/Jdbc连接远程数据库出错(java.net.ConnectException: Connection refused: connect)

今天遇到这个问题的时候,一开始一直在检查jdbc配置的数据源的属性是否正确,没想到之后写了个小demo,简单连接数据库都不行,这时候才怀疑起服务器(阿里云Ubuntu系统)那边的mysql服务器可能出现问题

在这些之前,你必须确保你的mysql user在服务器mysql中,是有权限的,可以看我的另一篇博文:

http://blog.csdn.net/ljphhj/article/details/20815125

如果你在eclipse、myclipse遇到的异常提示如下:

或者你用其他mysql视图化工具连接mysql数据库的时候出现如下情况:

这时候,你需要登录到服务器里面按照如下方法设置你的mysql 并 重启mysql

1. vim /etc/mysql/my.cnf

讲配置里面的bind-address = 127.0.0.1

这一项改成bind-address = 0.0.0.0

取消MySQL Server 绑定本地地址!

之后保存退出(wq)

2.sudo /etc/init.d/mysql restart (重启mysql服务)

这样就完成了,大家可以试试哈,困扰自己一个多小时的问题了哈,所以记录下来,希望可以帮到遇到同样问题的人


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK