MySQL MariaDB 不允许远程连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21664091/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 20:00:53  来源:igfitidea点击:

MariaDB not allowing remote connections

mysqlwindowswindows-server-2008mariadbnavicat

提问by ItsJamie

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

As the screenshots show, I have the accounts setup to allow remote connections but as shown in the second screenshot I still cannot connect remotely.

如屏幕截图所示,我已将帐户设置为允许远程连接,但如第二个屏幕截图所示,我仍然无法远程连接。

回答by LandiLeite

I use for testing in the virtual machine (Ubuntu 16.04), for me, I fixed the error changing the file 50-server.cnf.

我用于在虚拟机(Ubuntu 16.04)中进行测试,对我来说,我修复了更改文件的错误50-server.cnf

My server is Ubuntu, so changing the file below:

我的服务器是 Ubuntu,因此更改以下文件:

50-server.cnf

The path of this file:

这个文件的路径:

/etc/mysql/mariadb.conf.d

PS: Create a backup of the file before the change.

PS:在更改之前创建文件的备份。

Only change in file the bind-address 127.0.0.0to bind-address 0.0.0.0

仅在文件中更改bind-address 127.0.0.0bind-address 0.0.0.0

After this restart service and try again.

此后重新启动服务并重试。

Regarding that user, need to allow for external connections.

关于该用户,需要允许外部连接。

I hope that this info helps you.

我希望这些信息对您有所帮助。

回答by Fidel

Mysql by default binds to 0.0.0.0 which is all interfaces on your system. Which means you can already connect from another computer. The issue is perhaps permissions. You can enable remote connections by running the following command:

默认情况下,Mysql 绑定到 0.0.0.0,这是您系统上的所有接口。这意味着您已经可以从另一台计算机连接。问题可能是权限。您可以通过运行以下命令启用远程连接:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%' IDENTIFIED BY '' WITH GRANT OPTION;

回答by Joshua

MariaDB packages bind MariaDB to 127.0.0.1 (the loopback IP address) by default as a security measure using the bind-address configuration directive. Old MySQL packages sometimes disabled TCP/IP networking altogether using the skip-networking directive.

默认情况下,MariaDB 包将 MariaDB 绑定到 127.0.0.1(环回 IP 地址),作为使用 bind-address 配置指令的安全措施。旧的 MySQL 软件包有时会使用 skip-networking 指令完全禁用 TCP/IP 网络。

Steps to allow remote connections are provided in the MariaDB Knowledge Base at https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/

MariaDB 知识库中提供了允许远程连接的步骤,网址https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/