Additionally, please make sure, that a remote login to MySQL (or MariaDB) is allowed.
If you change the following, especially the IP, please - previously - make sure, that this has no side effects to anything else using the SQL-Server.
The address has to be changed there, accordingly.
The related files are:
MySQL : /etc/mysql/mysql.conf.d/50-server.cnf
MariaDB : /etc/mysql/mariadb.conf.d/50-server.cnf
- Look for the line starting with “bind-address”. It has to contain the IP which the SQL-Server is reachable at via network.
- also, please make sure that the line containing “skip-networking” is commented out.
After changes, the SQL-Server has to be restarted.
The connecting user has to be allowed to connect remotely.
This can be done by adding a suffix other than localhost (or similar) at creation time.
The suffix can be an IP/Subnet or wildcard, e.g.:
GRANT ALL ON <database>.* TO '<the_user>'@'<remote_ip' IDENTIFIED BY '<the_user_password>';
You can list the users and IPs by:
select user, host from mysql.user;