[英]ERROR 2003 (HY000): Can't connect to MySQL server on '10.0.0.5' (111)
I have two ubuntu VMs in azure. 我有两个蔚蓝的Ubuntu VM。 Both are Ubuntu 17.10 On is for database and the other for web.
两者都是Ubuntu 17.10, On用于数据库,另一个用于Web。 The database has mysql 5.7 set up.
该数据库已设置mysql 5.7 。 I have been trying to connect from the web server to db server.
我一直在尝试从Web服务器连接到数据库服务器。
I tried 我试过了
mysql -h 10.0.0.5
and got 并得到
ERROR 2003 (HY000): Can't connect to MySQL server on '10.0.0.5' (111)
错误2003(HY000):无法连接到“ 10.0.0.5”上的MySQL服务器(111)
I have also tried running the same line from db server. 我也尝试过从数据库服务器运行同一行。 I see the same output.
我看到相同的输出。 However it does work like this within the db server:
但是,它在数据库服务器中确实可以这样工作:
mysql -uroot
And it also works like this: 它也像这样工作:
mysql -h localhost
I have looked at several online solutions about this issue. 我查看了有关此问题的几种在线解决方案。 Mostly the solution is to uncomment
bind-address
line my.cnf. 通常,解决方案是取消注释
bind-address
行my.cnf。 However I don't find this line. 但是我找不到这条线。 I have tried adding the line
bind-address = 10.0.0.5
, but that crashes the mysql. 我尝试添加行
bind-address = 10.0.0.5
,但这会使mysql崩溃。
Note that I am able to ping from web server to db server. 请注意,我能够从Web服务器ping到数据库服务器。
Try following the steps mentioned in the answer to this question 尝试按照此问题的答案中提到的步骤进行操作
bind-address
on /etc/mysql/mysql.conf.d/mysqld.cnf
/etc/mysql/mysql.conf.d/mysqld.cnf
上设置bind-address
mysql
server mysql
服务器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.