I know this was discussed and over discussed and it might be a simple thing for some of you, but being a n00b and trying to fix it by myself drives me crazy. I got two VPS's running Ubuntu server 20.04 LTS.
VPS #1 runs MariaDB server 10.3.34. There is NO firewall running (not iptables, not ufw, nothing);
/etc/mysql/mariadb.conf.d/50-server.cnf looks like this:
#
# * 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
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
Doing netstat -ant | grep 3306 in terminal outputs:
netstat -ant | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3306 127.0.0.1:46154 TIME_WAIT
tcp 0 0 127.0.0.1:3306 127.0.0.1:59448 TIME_WAIT
tcp 0 0 127.0.0.1:3306 127.0.0.1:46174 TIME_WAIT
tcp 0 0 127.0.0.1:3306 127.0.0.1:46184 TIME_WAIT
tcp 0 0 127.0.0.1:3306 127.0.0.1:59432 TIME_WAIT
tcp 0 0 127.0.0.1:3306 127.0.0.1:59442 TIME_WAIT
tcp 0 0 127.0.0.1:46162 127.0.0.1:3306 TIME_WAIT
I did add an user to MariaDB, grant all privileges with remote access and everything seems ok!
MariaDB [(none)]> CREATE DATABASE xxxdb;
MariaDB [(none)]> CREATE USER 'xxxuser'@'%' IDENTIFIED BY 'password';
MariaDB [(none)]> GRANT ALL ON *.* to 'xxxuser'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
VPS #2 runs Ubuntu server 20.04 LTS and also I got mariadb-client installed and telnet.
Trying: mariadb -u xxxuser -h SERVERIP -P 3306 -p
mariadb -u xxxuser -h SERVERIP -P 3306 -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on 'SERVERIP' (110 "Connection timed out")
Trying to telnet outputs:
telnet SERVERIP 3306
Trying SERVERIP...
telnet: Unable to connect to remote host: Connection timed out
Please give me any help / support that you can. Anything will be appreciated! Thank you!