连接错误的提示信息为:ERROR 2002 (HY000): Can't connect to server on 'XXX.XXX.XXX.XXX' (115)
问题和解决
根据官方的提示:Configuring MariaDB for Remote Client Access Guide | Server | MariaDB Documentation
出现上面问题的原因是从版本: MariaDB starting with 10.11 开始,所有的数据库连接默认安装都都是拒绝远程连接的。
因此,在连接的时候都会得到:
(/my/maria-10.11) ./client/mariadb --host=myhost --protocol=tcp --port=3306 test
ERROR 2002 (HY000): Can't connect to MySQL server on 'myhost' (115)
(/my/maria-10.11) telnet myhost 3306
Trying 192.168.0.11...
telnet: connect to address 192.168.0.11: Connection refused
错误,但通过本地的连接就没有问题。
(my/maria-10.11) ./client/mariadb --host=localhost --protocol=tcp --port=3306 test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
配置文件路径
如果没有对安装进行修改,配置文件位于:
/etc/mysql/mariadb.conf.d/50-server.cnf
编辑这个配置文件,注释掉: bind-address = 127.0.0.1 这一行后重启服务。


