debian 11 + mariadb 遠端連接

debian 11 + mariadb 遠端連接

我在全新安裝的 Debian 11 上讓 mariadb 接受遠端連線時遇到問題。

我已將綁定地址更改為bind-address: 0.0.0.0.從同一台伺服器,我可以很好地遠端登入到連接埠 3306。我從遠端伺服器收到連線拒絕錯誤或錯誤 2002 (115)。

目前沒有運作防火牆。我可以很好地遠端登入其他服務端口,但無法使用 mysql。我缺什麼?

使用 MariaDB 的伺服器

tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN

來自伺服器的連接

telnet 192.168.0.143 3306
Trying 192.168.0.143...
Connected to 192.168.0.143.
Escape character is '^]'.
c
5.5.5-10.5.15-MariaDB-0+deb11u1#l#dQKa&9▒▒-+kZ`VmBBbFxMmysql_native_password

來自客戶端的連接

telnet 192.168.0.143 3306
Trying 192.168.0.143...
telnet: Unable to connect to remote host: Connection refused
mysql -u user -p -h 192.168.0.143
Enter password:
ERROR 2002 (HY000): Can't connect to MySQL server on '192.168.0.143' (115)

更新

我真的對發生的事情感到不知所措。從這個方塊中,我可以使用 127.0.0.1、192.168.0.143 或外部 IP 存取 mysql,沒有任何問題。

當嘗試從任何其他盒子進行連接時,它的表現就像被防火牆阻止一樣。

  • iptables 是我通常使用的,但我已經清除了所有規則,刷新了所有表,並且所有策略都設定為接受。
  • 我的雲端主機沒有運行防火牆 - 已與他們的支援團隊驗證。
  • 其他服務在外部連接得很好,這確實顯示了 mariadb 的特定問題。

MariaDB 目前綁定到應用程式 ipv4 和 ipv6 介面。我嘗試過只綁定到 ipv4,將預設連接埠更改為 3306 以外的連接埠。

Dec 29 15:57:14 myserver systemd[1]: Starting MariaDB 10.10.2 database server...
Dec 29 15:57:14 myserver mariadbd[141636]: 2022-12-29 15:57:14 0 [Note] /usr/sbin/mariadbd (server 10.10.2-MariaDB-1:10.10.2+maria~deb11) starting as process 141636 ...
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Number of transaction pools: 1
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Using liburing
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Completed initialization of buffer pool
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: 128 rollback segments are active.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: log sequence number 45507; transaction id 20
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] Plugin 'FEEDBACK' is disabled.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Buffer pool(s) load completed at 221229 15:57:15
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] Server socket created on IP: '0.0.0.0'.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] Server socket created on IP: '::'.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] /usr/sbin/mariadbd: ready for connections.
Dec 29 15:57:15 myserver mariadbd[141636]: Version: '10.10.2-MariaDB-1:10.10.2+maria~deb11'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
Dec 29 15:57:15 myserver systemd[1]: Started MariaDB 10.10.2 database server.

相關內容