简体   繁体   English

无法连接到AWS Lightsail计算机(61)/(111)上托管的远程MySQL数据库

[英]Cannot connect to remote MySQL database hosted on AWS Lightsail machine (61)/(111)

I am attempting to host a MySQL database on an AWS server and allow it to be queried from other machines (for the purpose of an app/website being developed). 我正在尝试在AWS服务器上托管MySQL数据库,并允许从其他计算机查询该数据库(以开发应用程序/网站为目的)。

I am a bit new to server-side administration so please bear with me. 我对服务器端管理有点陌生,所以请多多包涵。

I have no problem accessing and querying from mysql on the machine locally after I ssh in, however if I try to connect from my local machine via: ssh进入后,我在本地计算机上从mysql访问和查询没有问题,但是,如果我尝试通过以下方式从本地计算机连接:

    mysql -u <username> -p -h <domain>

I get: 我得到:

    ERROR 2003 (HY000): Can't connect to MySQL server on <domain> (111)

Trying it on another machine altogether gives the same error but with (61) instead of (111). 完全在另一台机器上尝试会产生相同的错误,但使用(61)而不是(111)。 I have already created my username and allowed access from any host via: 我已经创建了用户名,并允许通过以下方式从任何主机访问:

    GRANT ALL PRIVLEGES ON <table name> TO 'user'@'%' IDENTIFIED BY <password>

I have also made sure that port 3306 is open and changed the bind-address to 0.0.0.0 in the my.cnf file. 我还确保打开了端口3306,并将my.cnf文件中的绑定地址更改为0.0.0.0。

Any help would be appreciated. 任何帮助,将不胜感激。 Thank you! 谢谢!

The conf file was actually at /etc/mysql/mysql.conf.d/mysqld.cnf conf文件实际上位于/etc/mysql/mysql.conf.d/mysqld.cnf

Changing the bind-address = 0.0.0.0 in this file instead worked. 改为在此文件中更改bind-address = 0.0.0.0。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM