Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 1.16 KB

mysql.md

File metadata and controls

26 lines (23 loc) · 1.16 KB

Install MySQL DB

$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install mysql-server && sudo apt-get install mysql-client
$ sudo apt-get install libmysqlclient-dev
$ sudo apt-get install python-dev python3-dev
$ mysql -uroot -p
$ CREATE DATABASE dbname;
$ CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'password';
$ GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost';
$ FLUSH PRIVILEGES;

Test if user works:
$ mysql -udbuser dbname -p

Switch to HASS env
$ ssh pi@your_raspberry_pi_ip
$ sudo su -s /bin/bash homeassistant
$ source /srv/hass/homeassistant_venv/bin/activate
$ pip3 install --upgrade mysqlclient

Add to configuration.yaml

recorder:
  db_url: mysql://dbuser:password@localhost/dbname
  • Thank you to @sjorsjes for working step-by-step configuration instructions. Only modifications made are to identify the new homeassistant user instead of hass which was previously used when installing via the All-in-One Fabric installer (pre-December 2016).