Reputation: 625
I searched a lot but not able to solve that problem. i am able to access MySQL server running on different windows machine. steps i have taken are
GRANT ALL PRIVILEGES ON DATABASE.* TO user@'%' IDENTIFIED BY 'password';
mysql -h windows server ip -u user -p
it works fine and from MySQL workbench i am able to connect for windows MySQL server from my machine. BUT when in Linux virtual machine i have done the same thing
GRANT ALL PRIVILEGES ON DATABASE.* TO user@'%' IDENTIFIED BY 'password';
From command line to LINUX MySQL server mysql -h linux server ip -u user -p
but for that i am getting following error after giving password ERROR 2003 (HY000): Can't connect to MySQL server on 'linux server ip' (10060) also when connecting from c# by following connection string <add name="MySqlConnection" connectionString="Server=LINUX_VM_SERVER_IP;Database=database;Uid=user;Pwd=password" providerName="MySql.Data.MySqlClient" />
i am getting Error : Unable to find and specified mysql host
i have checked in LINUX_VM that 0.0.0.0:3306 is in listening status.
if i try to telnet LINUX_VM MYSQL Server service using />telnet
LINUX_VM_IP 3306
i got the ERROR : Connecting To
LINUX_VM_IP...Could not open connection to the host, on port 3306:
Upvotes: 1
Views: 4978
Reputation: 810
First, try to connect to the database on the VM hosting the database. If the connection is successful, then the configuration of the database is correct. Otherwise, please check the configuration of your database.
Second, if you are able to connect to database on the VM, then the most possible cause of this issue is firewall. Please check if the local firewall (iptables) allows inbound connection on port 3306. For test purpose, you may disable the firewall temporarily. Also, please check if the NSG has been configured properly to allow the inbound traffic on port 3306.
Besides, if the VNET has been associated with a NSG, then we need to allow the inbound traffic in the NSG too.
Upvotes: 3