EDIT 2:
the problem was solved by opening the 3306 port on Azure portal. I went to the VM > Networking
and added an Inbound Rule
. The connection from the outside immediately started working.
I have MySql 5.7 installed on a windows server 2012 virtual machine on Azure. Port 3306 is opened, and I run the following to allow remote access:
GRANT ALL PRIVILEGES
ON db_name.* TO 'user'@'%'
IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
I restarted MySql service and tried to connect again. But still the same error:
MySQL said: Can't connect to MySQL server on 'servername.eastus.cloudapp.azure.com' (4)
What am I missing?
EDIT: I looked at both the links in the "Duplicate" message. But it looks like my.ini
on the machine doesn't have any of the issues. Specifically there is no
#bind-address = 127.0.0.1
# skip-external-locking
that could be commented out. There is no mention of any ip address in the file. The only vaguely relevant part is this
[mysqld]
# The next three options are mutually exclusive to SERVER_PORT below.
# skip-networking
# enable-named-pipe
# shared-memory
# shared-memory-base-name=MYSQL
# The Pipe the MySQL Server will use
# socket=MYSQL
# The TCP/IP Port the MySQL Server will listen on
port=3306
So I still don't have an answer.