MariaDB Access from another network host

Using hassio with MariaDB addon. Home Assistant is logging activity as it should in MariaDB.

But I can’t access MariaDB from another machine on the network.

My configuration:

databases:
  - homeassistant
logins:
  - username: homeassistant
    password: mypass
rights:
  - username: homeassistant
    database: homeassistant
    grant: ALL PRIVILEGES ON

My access attempt:

sudo mysql --host=nnn.nnn.nnn.nnn --user=homeassistant --password=mypass homeassistant

Tried to follow the documentation - again, the database logs correctly, but would like to access the database from another host?

1 Like

im running home assistant core, but i think it might be somewhat the same.

install these first:
sudo apt install libmariadbclient-dev libssl-dev

install the python mysql client:
pip3 install mysqlclient

allow remote login from user om mariadb:
sudo mysql
GRANT ALL ON *.* TO 'user'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

configure mariadb to listen to all ip addresses:
sudo nano nano /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 0.0.0.0
systemctl restart mariadb

create homeassistant db in mariadb:
i just use heidisql for this

restart home assistant.

Thanks for the suggestion.

I’m using the hassio operating system where mariaDB is an addon. I can’t install any packages or edit any /etc/mysql/ configuration files for mysql.

I may have chosen the wrong installation option! I’m suspecting there is NO WAY to access the database from another local network host unless I switch the database to another host on the local network.

I don’t know if it still relevant or not but with the addon port 3306 is disabled by default for the host, just add a port number to the addon en restart the addon and you can connect to it from your network

3 Likes

hello breinrs92, your suggestion fixed the issue - thank you so much!