首页 > 解决方案 > 如何远程或通过 IP 地址连接到 mariaDB?

问题描述

mysql -V
mysql  Ver 15.1 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

我可以连接:

 mysql -h localhost  -uroot -pmysecretPassword

然后我尝试连接

mysql -h XXX.XXX.XXX.XXX -uroot -pmysecretPassword

并得到 ERROR 1045 (28000): Access denied for user 'root'@'ns10003.XXXXX' (使用密码: YES)

其中 XXX.XXX.XXX.XXX 是我的服务器 IP

我用

telnet XXX.XXX.XXX.XXX 3306 

我得到了一个连接:mysql 在端口 3306 上的 XXX.XXX.XXX.XXX 上运行

我的配置mysql文件/etc/mysql/mariadb.conf.d/50-server.cnf

[mysqld]
innodb_strict_mode = 0
sql-mode="NO_ENGINE_SUBSTITUTION"

#
# * Basic Settings
#
user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
socket                  = /run/mysqld/mysqld.sock
#port                   = 3306
basedir                 = /usr
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
lc-messages-dir         = /usr/share/mysql
#skip-external-locking
#skip-networking=1
#skip-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.0.0.1
bind-address            = 0.0.0.0

一切对我来说都很好。没有 iptables 规则:

为什么我不能远程连接到我的服务器或使用它的 IP?

标签: mysqlmariadb

解决方案


推荐阅读