[英]how to connect to a mysql server running on a linux virtual machine in azure
I searched a lot but not able to solve that problem. 我进行了很多搜索,但无法解决该问题。 i am able to access MySQL server running on different windows machine. 我能够访问在不同Windows计算机上运行的MySQL服务器。 steps i have taken are 我采取的步骤是
GRANT ALL PRIVILEGES ON DATABASE.* TO user@'%' IDENTIFIED BY 'password';
通过授予GRANT ALL PRIVILEGES ON DATABASE.* TO user@'%' IDENTIFIED BY 'password';
创建用户并授予许可GRANT ALL PRIVILEGES ON DATABASE.* TO user@'%' IDENTIFIED BY 'password';
mysql -h windows server ip -u user -p
从命令行到Windows MySQL服务器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. 它工作正常,并且可以从MySQL工作台从我的机器连接Windows MySQL服务器。 BUT when in Linux virtual machine i have done the same thing 但是在Linux虚拟机中我做过同样的事情
GRANT ALL PRIVILEGES ON DATABASE.* TO user@'%' IDENTIFIED BY 'password';
通过授予GRANT ALL PRIVILEGES ON DATABASE.* TO user@'%' IDENTIFIED BY 'password';
创建用户并授予许可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
从命令行到LINUX MySQL服务器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 但是为此,我在输入密码错误2003(HY000)后收到以下错误:在通过以下连接字符串<add name="MySqlConnection" connectionString="Server=LINUX_VM_SERVER_IP;Database=database;Uid=user;Pwd=password" providerName="MySql.Data.MySqlClient" />
从c#连接时,也无法连接到'linux服务器ip'(10060)上的MySQL服务器 <add name="MySqlConnection" connectionString="Server=LINUX_VM_SERVER_IP;Database=database;Uid=user;Pwd=password" providerName="MySql.Data.MySqlClient" />
我遇到错误:无法找到并指定mysql主机
i have checked in LINUX_VM that 0.0.0.0:3306 is in listening status. 我已经在LINUX_VM中检查到0.0.0.0:3306处于侦听状态。
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: 如果我尝试使用/>telnet LINUX_VM_IP 3306
telnet LINUX_VM MYSQL Server服务,则出现错误:连接到LINUX_VM_IP ...无法打开端口3306上的主机连接:
First, try to connect to the database on the VM hosting the database. 首先,尝试连接到托管数据库的VM上的数据库。 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. 其次,如果您能够连接到VM上的数据库,则此问题的最可能原因是防火墙。 Please check if the local firewall (iptables) allows inbound connection on port 3306. For test purpose, you may disable the firewall temporarily. 请检查本地防火墙(iptables)是否允许端口3306上的入站连接。出于测试目的,您可以暂时禁用防火墙。 Also, please check if the NSG has been configured properly to allow the inbound traffic on port 3306. 另外,请检查NSG是否已正确配置为允许端口3306上的入站流量。
Besides, if the VNET has been associated with a NSG, then we need to allow the inbound traffic in the NSG too. 此外,如果VNET已与NSG关联,那么我们也需要允许NSG中的入站流量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.