I have two ubuntu VMs in azure. Both are Ubuntu 17.10 On is for database and the other for web. The database has mysql 5.7 set up. I have been trying to connect from the web server to db server.
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)
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. However I don't find this line. I have tried adding the line bind-address = 10.0.0.5
, but that crashes the mysql.
Note that I am able to ping from web server to db server.
Try following the steps mentioned in the answer to this question
bind-address
on /etc/mysql/mysql.conf.d/mysqld.cnf
mysql
server