Search code examples
mysqlremote-accesssynology

MySql database allow remote connections


I am using a synology 713+ nas server, and just started using MySQL with it.

I created a database, a table and a user with '%' as host, so it should be able to connect from anywhere.

Using the local ip to the nas-server, I am able to connect to the database without a problem. But when I try using the external ip, I get the following message instantly;

'Unable to connect to any of the specified MySQL hosts.'

In the 'my.cnf' file, I have disabled 'skip-networking' and set 'bind-address' to 0.0.0.0.

I am unable to see the 'bind-address' variable in phpMyAdmin, so I am unsure if it is actually using it.

If I try to connect while the database is offline, I times out after 30 seconds, but when it is online it refuses instantly, which tells me that it is able to find the server, but not allowed to connect.

What in the world is going on, and what can I do?

Edit:

All ports on the nas are open, and my router is forwarding port 3306 to the nas. Restarting mysql and the whole nas did not work.

I suspect the 'bind-address' variable is not being used...


Solution

  • I had encountered a similar issue, This solution worked for me

    1. Login into local server with the user (root in most cases)
    2. create a new user and set a password for new user.
    3. Make this new user as db-owner and give all permissions to the new user.
    4. Remote Side - Login into the server with new created user id and password. Now you should be able to connect.

    Also check the ip of the host and MySQL port. Default MySQL port might be 3306.