MySQL/Maria DB

I am trying to run Home Assistant with a Maria database server running on a different Raspberry Pi. I hace successfully installed the database server on the non Home Assistant Pi but I cannot work out what client software I need to install on the Home Assistant machine.

I am running the latest Hassbian build.

Any ideas please.

If I understand your question correct you only need to change the settings in the configuration. Yaml under recorder:

Tried that but get the following message in homeassistant.log when it starts.

Error during connection setup: No module named ‘MySQLdb’ (retrying in 3 seconds)

I am assuming I must install the MSQL client on the Pi running hasbian but not sure how to do this without install the mysql server as well.

For whar should you use the db?

https://community.home-assistant.io/t/issue-with-remote-mariadb-using-hassio/48107

If you have your Home Assistant in a virtual environment, you’d probably need to install this:
sudo apt install libmysqlclient-dev
and also do this:
source /srv/homeassistant/bin/activate
pip3 install mysqlclient

OK can be. I run mine in a docker on a dedicated ubuntu server with docker

As you are trying to use Docker I recommend you to use MySQL Docker image instead of using the Host MySQL.

Incase you still want to use the host mysql, you may need to do the following steps.

In your host mysql’s my.cnf set the bind address to 0.0.0.0 so that mysql listens on all network interfaces

Thanks for the suggestions. Managed to get it working by following the online documentation. Doh! Thought I had done that at the start.

pi@homeassistant:~ $ sudo -u homeassistant -H -s
homeassistant@homeassistant:~$ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@homeassistant:~$ pip3 install mysqlclient

and then:

$ sudo apt-get install libmariadbclient-dev libssl-dev
$ pip3 install mysqlclient

Next time I will make sure to RTFM!

1 Like

You are not alone