Debian 12 上的 MariaDB 11.5.2。
我已经为我的服务器创建了证书,位于/etc/acme
模式 644(所有者 root,组 mysql)
/etc/mysql/mariadb.conf.d $ cat 99-bsz.cnf
[mysqld]
bind-address = 0.0.0.0
ssl-ca = /etc/ssl/certs/sectigo-ca.pem
ssl-cert = /etc/acme/hostname-fullchain.pem
ssl-key = /etc/acme/hostname-key.pem
#require-secure-transport = on # played with this oiption, nothing helps
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#innodb_buffer_pool_size = 8G
cat 50-client.cnf
[client-mariadb]
ssl
ssl-verify-server-cert
但它不起作用
$ mariadb -p -u root
Enter password:
ERROR 2026 (HY000): TLS/SSL error: Hostname verification failed
当我设置
cat 50-client.cnf
[client-mariadb]
host= hostname.tld
mariadb -p
有效。因此,它需要有效的 FQDN,localhost
或者127.0.0.1
还不够。然后我可以检查我的连接是否启用了 TLS,并且status
显示SSL: Cipher in use is TLS_AES_256_GCM_SHA384, cert is OK
但未REQUIRE SSL
设置root
。
> SELECT user,host FROM mysql.user WHERE ssl_type <> '';
+------------+----------------+
| User | Host |
+------------+----------------+
| user1 | X.Y.Z.W |
| user2 | X.Y.Z.W |
| user3 | X.Y.Z.W |
+------------+----------------+
这些都是需要 SSL 的远程用户。但为什么root
也强制使用 SSL?
3
localhost
有一个特殊含义“使用 Unix 套接字文件连接”,而不是“通过 IP 地址为 127.0.0.1 的 TCP/IP 连接”。dev.mysql.com/doc/refman/8.4/en/ 事实上,在错误消息中,IP 地址在反向 DNS 查找后显示(即 127.0.0.1 显示为 localhost),这无助于故障排除。因此,对于您的第二条错误消息:检查您的 GRANT 表,看看是否已为用户“root”@“127.0.0.1”设置了访问权限,而不仅仅是“root”@“localhost”。–
–
–
|