我甚至不知道从哪里开始。我有一个问题,远程连接到我的MariaDB服务器CentOS7服务器。我在服务器1 (192.168.1.34)上安装了MariaDB版本10.4.17
mariadb -v
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.4.17-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Reading history-file /root/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.这是我的数据库服务器上的mariadb设置1. /etc/my.cnf.d
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
#[mysqld]
[mysqld_safe]
log_error=/var/log/mysql/mysql_error.log
[mysqld]
log_error=/var/log/mysql/mysql_error.log
#bind-address = 0.0.0.0
skip-networking=0
#skip-bind-address
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
log_error=/var/log/mysql/mariadb_error.log
bind-address = 0.0.0.0
# This group is only read by MariaDB-10.4 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.4]这是我在服务器1上的mariadb的用户列表。
SELECT User, Host, plugin FROM mysql.user;
+-------------+--------------+-----------------------+
| User | Host | plugin |
+-------------+--------------+-----------------------+
| mariadb.sys | localhost | mysql_native_password |
| root | localhost | mysql_native_password |
| mysql | localhost | mysql_native_password |
| mytracker | localhost | mysql_native_password |
| myadmin | 192.168.1.32 | mysql_native_password |
| mytracker | 192.168.1.32 | mysql_native_password |
| mytracker | 192.168.1.33 | mysql_native_password |
+-------------+--------------+-----------------------+
7 rows in set (0.001 sec)这是MariaDB中所有插件的列表。
SELECT PLUGIN_NAME, PLUGIN_STATUS
FROM INFORMATION_SCHEMA.PLUGINS;
+-------------------------------+---------------+
| PLUGIN_NAME | PLUGIN_STATUS |
+-------------------------------+---------------+
| binlog | ACTIVE |
| mysql_native_password | ACTIVE |
| mysql_old_password | ACTIVE |
| wsrep | ACTIVE |
| CSV | ACTIVE |
| MEMORY | ACTIVE |
| Aria | ACTIVE |
| MyISAM | ACTIVE |
| MRG_MyISAM | ACTIVE |
| CLIENT_STATISTICS | ACTIVE |
| INDEX_STATISTICS | ACTIVE |
| TABLE_STATISTICS | ACTIVE |
| USER_STATISTICS | ACTIVE |
| SQL_SEQUENCE | ACTIVE |
| InnoDB | ACTIVE |
| INNODB_TRX | ACTIVE |
| INNODB_LOCKS | ACTIVE |
| INNODB_LOCK_WAITS | ACTIVE |
| INNODB_CMP | ACTIVE |
| INNODB_CMP_RESET | ACTIVE |
| INNODB_CMPMEM | ACTIVE |
| INNODB_CMPMEM_RESET | ACTIVE |
| INNODB_CMP_PER_INDEX | ACTIVE |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE |
| INNODB_BUFFER_PAGE | ACTIVE |
| INNODB_BUFFER_PAGE_LRU | ACTIVE |
| INNODB_BUFFER_POOL_STATS | ACTIVE |
| INNODB_METRICS | ACTIVE |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE |
| INNODB_FT_DELETED | ACTIVE |
| INNODB_FT_BEING_DELETED | ACTIVE |
| INNODB_FT_CONFIG | ACTIVE |
| INNODB_FT_INDEX_CACHE | ACTIVE |
| INNODB_FT_INDEX_TABLE | ACTIVE |
| INNODB_SYS_TABLES | ACTIVE |
| INNODB_SYS_TABLESTATS | ACTIVE |
| INNODB_SYS_INDEXES | ACTIVE |
| INNODB_SYS_COLUMNS | ACTIVE |
| INNODB_SYS_FIELDS | ACTIVE |
| INNODB_SYS_FOREIGN | ACTIVE |
| INNODB_SYS_FOREIGN_COLS | ACTIVE |
| INNODB_SYS_TABLESPACES | ACTIVE |
| INNODB_SYS_DATAFILES | ACTIVE |
| INNODB_SYS_VIRTUAL | ACTIVE |
| INNODB_MUTEXES | ACTIVE |
| INNODB_SYS_SEMAPHORE_WAITS | ACTIVE |
| INNODB_TABLESPACES_ENCRYPTION | ACTIVE |
| INNODB_TABLESPACES_SCRUBBING | ACTIVE |
| PERFORMANCE_SCHEMA | ACTIVE |
| SEQUENCE | ACTIVE |
| unix_socket | ACTIVE |
| FEEDBACK | DISABLED |
| user_variables | ACTIVE |
| partition | ACTIVE |
+-------------------------------+---------------+
54 rows in set (0.001 sec)因此,当我转到服务器2进行远程客户端连接时,下面是错误:
[root@server2 ~]# mysql --host=192.168.1.34 --user=myadmin --password=’**********’ -P3306
ERROR 1045 (28000): Access denied for user 'myadmin'@'192.168.1.32' (using password: YES)
[root@wp2 ~]#这是我的安全安装设置。
mysql_secure_installation
enter current password for root HIT ENTER since root password doesn’t exist yet.
switch to Unix_socket authentication N
change the root password: Y
New password: *****************
Re-enter new password: *****************
Remove anonymous users: Y
Disallow root login remotely: n
Remove test database and access to it: Y
Reload privilege tables now: y我曾尝试打开和关闭Unix_socket身份验证,但它给了我相同的问题。我到处寻找,但似乎找不到可行的解决方案。我也尝试了auth_socket.so路径,但似乎到处都找不到so文件。为了让我远程连接到我的MariaDB服务器,有没有我需要知道您才能分享的技巧?我被难住了。请帮帮忙?
发布于 2021-01-15 08:14:29
我不知道发生了什么,但现在它似乎起作用了。我现在可以连接了。我不能解释为什么或者什么。我猜我的设置是这样工作的。希望上面的设置可以帮助将来可能遇到我所面临的问题的用户。
https://stackoverflow.com/questions/65726260
复制相似问题