Closed B1tMaster closed 6 years ago
Keep getting connection refused..
useful discussions:
https://community.home-assistant.io/t/setting-up-mysql-on-a-synology-nas-docker-container/16253/2
https://community.home-assistant.io/t/need-help-with-mariadb-addon/32687/2
SOLVED: I had the same problem and no matter what i tried I kept getting connection refused message in the logs. To test what is wrong I attempted to connect from the outside haas from my laptop using MYSqlWorkbench app. I saw the same error as connection refused for “haas” user Then I changed the host name in both sections of the MariaDB host="%" , but still continued seeing the error.
Then I decided to create a NEW user “haas_admin” and all of a sudden I was able to connect from my laptop. I immediately went back to my configuration.yaml file and changed to the connection string to use this new uer. And everything started working like a charm.
I don’t know the reason for it, but maybe add-on is not properly making changes to a username that was previosly created with wrong configuration options. (though I am not sure about it)
Anyway, here is a working config (I added an additional user without removing a non-working haas user. ) I will try later to delete the original haas user from the config, but for now just posting what worked for me as is.
{
"databases": [
"homeassistant"
],
"logins": [
{
"username": "hass",
"host": "homeassistant",
"password": "mypassword"
},
{
"username": "haas_admin",
"host": "%",
"password": "my-password"
}
],
"rights": [
{
"username": "hass",
"host": "homeassistant",
"database": "homeassistant",
"grant": "ALL PRIVILEGES ON"
},
{
"username": "haas_admin",
"host": "%",
"database": "homeassistant",
"grant": "ALL PRIVILEGES ON"
}
]
}
And this is a connect string:
mdb_url: mysql://haas_admin:my-password@core-mariadb/homeassistant?charset=utf8
Hope creating a different user will resolve somebody’s problem. Note: using “%” for host allow connections from inside home-assistant and from outside.
migrate after upgrade to haas.io https://home-assistant.io/addons/mariadb/