Home > Blockchain >  Remote user is not able to connect to mariadb
Remote user is not able to connect to mariadb

Time:12-15

MariaDB is installed on server with IP 1.2.3.4, new MySQL user has been created on 1.2.3.4 for remote IP a.b.c.d, but while trying to connect MySQL on 1.2.3.4 from a.b.c.d giving error:

ERROR 2003 (HY000): Can't connect to MySQL server on '1.2.3.4' (111 "Connection refused")

Investigation-:

  1. trying to telnet from a.b.c.d to 1.2.3.4 at port 3306 also not working
  2. surprisingly when trying to connect mysql from 1.2.3.4 directly using server IP 1.2.3.4 is also throwing error "ERROR 2003 (HY000): Can't connect to MySQL server on '1.2.3.4' (111)
  3. While trying to connect mysql using mysql -h localhost -u root -p is successfully working.

What we are looking for, we want to connect mysql from a.b.c.d to 1.2.3.4, please suggest what we are missing.

addtional information:

  1. on server 1.2.3.4 /etc/mysql/my.cnf is not present, there exist '/etc/my.cnf'
  2. trying to find solution we are referring link "webdock.io/en/docs/how-guides/database-guides/…" some edit is mentioned to in file "/etc/mysql/my.cnf" which is not present.

CodePudding user response:

Some points to consider.

  1. Check firewall (port 3306 should be allowed for the remote ip if you are running MariaDB on 3306 port )

  2. The user should exists (which you have) and it should be something like;

    user@your_remote_ip

  3. Check bind-address in the configuration file, if it set to 127.0.0.1 it will allow only localhost login.

  4. It is a good idea to check the logs , usually located on /var/log/mysql/ or you could verify from the configuration file where the logs are located

    log_error = /var/log/mysql/error.log

CodePudding user response:

Most probably it might be a firewall issue.

Make sure that the port on which the database server is running is not closed and is exposed publicly.

Also check if the database configurations allow binding IP is not only set to 127.0.0.1 but every IP can bind.

  • Related