[英]mariadb can't connect to server remotely
This is my first time trying to create an sql server that can be accessed remotely by a user.这是我第一次尝试创建一个用户可以远程访问的 sql 服务器。 I believe I have set this up correctly but am unable to connect to my server remotely.
我相信我已正确设置,但无法远程连接到我的服务器。
When I run sudo mysql -u user1 -h <google vm external ip address> -p
I get the below error after entering my password当我运行
sudo mysql -u user1 -h <google vm external ip address> -p
输入密码后出现以下错误
ERROR 2003 (HY000): Can't connect to MySQL server on '<google vm external ip address>' (11 "Resource temporarily unavailable")
I've tried to find out what might be the cause of this but only seem to find articles relating to the server being offline (which it's not) or steps on how to do the set up I've already done so far.我试图找出可能是什么原因造成的,但似乎只找到与服务器脱机相关的文章(事实并非如此)或有关如何进行设置的步骤我到目前为止已经完成。 If anyone has any further steps I might be able to check it would be appreciated.
如果有人有任何进一步的步骤,我可能会检查它,将不胜感激。
mysql Ver 15.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 Connection id: 33 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server: MariaDB Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04 Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Uptime: 38 min 12 sec
%
would allow my user to connect from anywhere, as shown below.%
将允许我的用户从任何地方进行连接,如下所示。+-----------+-------+ | host | user | +-----------+-------+ | % | user1 | | localhost | user1 | | localhost | root | +-----------+-------+
/etc/mysql/mariadb.conf.d/*.cnf
file to comment out the bind address/etc/mysql/mariadb.conf.d/*.cnf
文件以注释掉绑定地址# Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. #bind-address = 127.0.0.1
First time server user... turns out google vm blocks everything coming in like mysql or postgres so you need to create an exception in the firewall rules for this.第一次使用服务器用户...原来 google vm 阻止了像 mysql 或 postgres 这样的所有内容,因此您需要为此在防火墙规则中创建一个例外。
Documentation I found helpful to set up an exclusion in the rules - https://cloud.google.com/vpc/docs/firewalls?authuser=1我发现有助于在规则中设置排除项的文档 - https://cloud.google.com/vpc/docs/firewalls?authuser=1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.