V
V
Vincent12021-10-18 15:24:57
MySQL
Vincent1, 2021-10-18 15:24:57

How to set up a remote connection to mysql?

Unable to set up remote access to mysql. There is no connection to port 3306, I tried to write to my.cnf bind-address = 0.0.0.0but nothing has changed.
Version

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


netstat -l
[email protected]:~# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 localhost:8084          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:ftp             0.0.0.0:*               LISTEN
tcp        0      0 localhost:domain        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:14391           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:smtp            0.0.0.0:*               LISTEN
tcp        0      0 li727-45.members.:https 0.0.0.0:*               LISTEN
tcp        0      0 li727-45.members.l:8443 0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:49505           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:49506           0.0.0.0:*               LISTEN
tcp        0      0 localhost:mysql         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:submission      0.0.0.0:*               LISTEN
tcp        0      0 li727-45.members.l:http 0.0.0.0:*               LISTEN
tcp        0      0 li727-45.membe:http-alt 0.0.0.0:*               LISTEN
tcp        0      0 localhost:tproxy        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:submissions     0.0.0.0:*               LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
udp        0      0 localhost:domain        0.0.0.0:*
raw6       0      0 [::]:ipv6-icmp          [::]:*                  7

iptables -S
[email protected]:~# iptables -S
-P INPUT DROP
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N fail2ban-FTP
-N fail2ban-HESTIA
-N fail2ban-MAIL
-N fail2ban-RECIDIVE
-N fail2ban-SSH
-N hestia
-A INPUT -p tcp -m tcp --dport 14391 -j fail2ban-HESTIA
-A INPUT -p tcp -m multiport --dports 25,465,587,110,995,143,993 -j fail2ban-MAIL
-A INPUT -p tcp -m tcp --dport 21 -j fail2ban-FTP
-A INPUT -p tcp -m tcp --dport 22 -j fail2ban-SSH
-A INPUT -p tcp -m multiport --dports 1:65535 -j fail2ban-RECIDIVE
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 23.239.21.45/32 -j ACCEPT
-A INPUT -s 127.0.0.1/32 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 4242 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 3306,5432 -j ACCEPT
-A INPUT -s 95.216.143.20/32 -p tcp -m multiport --dports 3306,5432 -j ACCEPT
-A INPUT -s 91.241.225.212/32 -p tcp -m tcp --dport 49505 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 49506 -j ACCEPT
-A INPUT -s 91.241.225.212/32 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
-A INPUT -s 91.241.225.212/32 -p tcp -m multiport --dports 21,12000:12100 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 25,465,587 -j ACCEPT
-A INPUT -s 91.241.225.212/32 -p tcp -m tcp --dport 14391 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A fail2ban-FTP -j RETURN
-A fail2ban-HESTIA -j RETURN
-A fail2ban-MAIL -j RETURN
-A fail2ban-RECIDIVE -j RETURN
-A fail2ban-SSH -j RETURN

my.cnf default settings
[client]
port=3306
socket=/var/run/mysqld/mysqld.sock

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock

[mysqld]
bind-address = 0.0.0.0
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
port=3306
basedir=/usr
datadir=/var/lib/mysql
tmpdir=/tmp
lc-messages-dir=/usr/share/mysql
log_error=/var/log/mysql/error.log

symbolic-links=0
local-infile=0

skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 16M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

#innodb_use_native_aio = 0
innodb_file_per_table

max_connections=70
max_user_connections=30
wait_timeout=10
interactive_timeout=50
long_query_time=5

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

_____________
В папках ничего нет
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vincent1, 2021-10-18
@Vincent1

In one more place, bind-address = 127.0.0.1 was specified in the settings, so I did not pay attention to bind-address = 0.0.0.0.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question