Paco_Schumi
Paco_Schumi

Reputation: 11

Mariadb at synology refusing connection

I'm trying to connect from my django project to mariadb hosted on my synology nas. When I try to make migrations, the shell returns that connection was refused all time.

I added a file my.cnf with this: synology instructions for custom settings

[mysqld]
skip-networking=0
bind-address=0.0.0.0

Also created a user with different hosts, including: %, ip of web server, localhost, nas network name,...

Also checked NAS firewall. I created a rule to allow all connections from web server ip. If I disable it a get a time out error, so it seems to work.

My project settings are these:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': "db_name,
        'USER': 'user',
        'PASSWORD': 'pwd',
        'HOST': 'nas ip',
        'DATABASE_PORT':'3307',
    }
}

Any clues? I'm lost...

Thank you in advance

Upvotes: 1

Views: 1394

Answers (1)

peanutz
peanutz

Reputation: 11

Looking the main config file for MariaDB10 which is:
/usr/local/mariadb10/etc/mysql/my.cnf
Which is a symlink to:
-> /volume1/@appstore/MariaDB10/usr/local/mariadb10/etc/mysql/my.cnf

It shows us (truncated):

[mariadb]
plugin_load_add = synology_password_check
!include /var/packages/MariaDB10/etc/my.cnf
!include /var/packages/MariaDB10/etc/my_port.cnf
!include /var/packages/MariaDB10/etc/synology.cnf

So when you edit '/var/packages/MariaDB10/etc/my.cnf' two more includes are done after yours, with the contents of synology.cnf:

# DO NOT EDIT THIS FILE !!!
# You can change the port on user interface of MariaDB10.
# Please add other custom configuration to /var/packages/MariaDB10/etc/my.cnf
[mysqld]
skip_networking=1

Thats why it doesnt work. The 'skip_networking=1' comes after yours, superseding your configuration.

My guess to make it work, probably change this file instead. I really is says dont edit, but '/usr/local/mariadb10/etc/mysql/my.cnf' also says not to edit, so your not left with any choice.

I suspect that if MariaDB ever updates this file will be overwritten, so be careful and remember that if one morning its not working again, that's the reason why.

Upvotes: 0

Related Questions