No database or database user is created during this setup and will need to be created manually.
Consequently I followed these steps:
$ sudo mysql -u root -p
$ CREATE DATABASE homeassistant;
$ CREATE USER âhomeassistantuserâ IDENTIFIED BY âpasswordâ;
$ GRANT ALL PRIVILEGES ON homeassistant.* TO âhomeassistantuserâ;
$ FLUSH PRIVILEGES; $ exit
And added following information in my configuration.yaml
FWIW, I just got mariadb working in homeassistant on stretch. I didnât use @digieuropeâs curl request, but I did use his mysql configuration steps:
Here were my steps:
Logged in as homeassistant user AND activated virtualenv (for the pip3 installation):
Back up database
# "Backup" of database
mkdir db-bkup
mv home-assistant_v2.db db-bkup
Log into mysql client (youâll be prompted for password, I made one up):
sudo mysql -u root -p
Configure mysql database as per @digieuropeâs instructions:
MariaDB [(none)]> CREATE DATABASE homeassistant;
MariaDB [(none)]> CREATE USER â<some_user>â IDENTIFIED BY â<some_password>â;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON homeassistant.* TO â<some_user>â;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit
Restart home assistant
Worked like a charm for me!
WARNING: I wrote out these steps from memory, and YMMV!! So be careful and back up anything youâre worried about losing.
thank you. Iâve installed it, created user as homeassistantuser. with this
db_url: mysql://homeassistantuser:password@localhost/homeassistant in config,
but getting this error
2018-01-17 16:50:41 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: No module named âMySQLdbâ (retrying in 3 seconds)
in the localhost space do i put the rpi ip address?
Hi Iâm trying to read the monthly consumption sensor on my POW sonoff with tasmota. I installed MariaDB add-on in HASSIO.
When I reboot, I can not see the sensor. Could you help me?
I attach the script and the sensor configuration
Thankâs!
name: Average Energy Consumption
query: >
SELECT ROUND(AVG(avg_per_day),2) âvalueâ
FROM (
SELECT AVG(state) AS avg_per_day
FROM homeassistant.states
WHERE entity_id = âsensor.energy_yesterdayâ
AND state != âunknownâ
AND state != ââ
AND created > NOW() - INTERVAL 1 MONTH
homeassistant (created)
) avgs;
column: âvalueâ
unit_of_measurement: kWh