环境
mariadb Ver 15.1 Distrib 10.1.38-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Ubuntu 18.04.2
问题
mysql -h 192.168.0.5 -u root -p
报错如下:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘192.168.0.4’ (111 “Connection refused”)
解决方法
参考官方解释(真香)
https://mariadb.com/kb/en/library/configuring-mariadb-for-remote-client-access/
- 把/etc/mysql/mariadb.conf.d/50-server.cnf 下面的bind-address 注释掉,如下所示:
# 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