简体   繁体   English

错误2003(HY000):无法连接到“ 10.0.0.5”上的MySQL服务器(111)

[英]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 尝试按照此问题的答案中提到的步骤进行操作

  • set bind-address on /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf上设置bind-address
  • restart mysql server 重启mysql服务器
  • check if it listens on the defined address 检查它是否监听定义的地址
  • create a user for the remote connection 为远程连接创建用户
  • grant the privilages 授予特权
  • flush privilages 冲洗特权

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 2003 (HY000):无法连接到“127.0.0.1:3306”上的 MySQL 服务器 (111) - ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111) 错误2003(HY000):无法连接到“ xx.xx.xx.xx”上的MySQL服务器。 (60) - ERROR 2003 (HY000): Can't connect to MySQL server on 'xx.xx.xx.xx.' (60) ERROR 2002(HY000):无法通过套接字'/var/run/mysqld/mysqld.sock'连接到本地MySQL服务器(111) - ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) 错误2002(HY000):无法通过套接字'/opt/lampp/var/mysql/mysql.sock'连接到本地MySQL服务器(111“连接被拒绝”) - ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (111 “Connection refused”) MYSQL 拒绝远程连接,出现错误“ERROR 2003 (HY000)”和 TCP 错误 111 - MYSQL refuses remote connection with error “ERROR 2003 (HY000)” and TCP error 111 无法在ubuntu 14.04错误2002(HY000)上连接到mysql服务器 - Can't connect to mysql server on ubuntu 14.04 ERROR 2002 (HY000) ERROR 2002(HY000):my.cnf更新后无法连接到本地MySQL服务器 - ERROR 2002 (HY000): Can't connect to local MySQL server after my.cnf update 无法访问远程mysql ubuntu错误2003(HY000): - Can't access remote mysql ubuntu ERROR 2003 (HY000): 错误 2002 (HY000):无法通过套接字“/var/run/mysqld/mysqld.sock”连接到本地 MySQL 服务器 - ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' ERROR 2002 (HY000): 无法通过 socket '/var/run/mysqld/mysql.sock' 连接到本地 MySQL 服务器 (2) - ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM