Home-assistant.db 30Gbyte in one day, what to do?

well I followed instructions and moved to mysql too

I did this

Add the following to your configuration.yaml file:
recorder:
db_url: mysql://hassuser:[email protected]/db_name?charset=utf8

and I have this error. Where do I give name to the DB?

17-05-19 16:22:41 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (_mysql_exceptions.OperationalError) (1049, "Unknown database 'db_name'") (retrying in 3 seconds)

I understood hass_db

where is this stored?

I rewrote my automations / sensors so that they do not use time as a trigger or as a sensor update entity. This reduces the entries number is mysql database by 80%.

I also found entries in the database that seem to serve no purpose for the logbook or history and can be deleted. Although these entries are numerous, they don’t take a lot of room, but might slow searches.

1 Like

Did you install MySQL and the requirements as laid out in the thread? Did you create the user, db, etc. as explained in the thread?

Or did you just change your configuration.yaml?

There’s prerequisites to moving from one DB platform to another, you can’t just change a line in the config. Inatalling MySQL and creating the user and blank db are a big part of this; you will need to read that thread.

And I would suggest reading some of my findings at the end before moving forward; there are some things that you will want to do in the initial setup that are a lot more difficult to do AFTER you install and move to MySQL that will make a big difference in performance and storage space.

yes followed this link

My URL looks like this:

db_url: 'mysql://dbuser:password@localhost/hass?charset=utf8'

Keep in mind that the dbuser name/password is the user you set up in MySQL, not the credentials in HA (assuming you didn’t use the same credentials in MySQL as you did in HA). hass is the name of my database, btw - note the pathing.

Also I would suggest reading this post before you go any further. As I said, this makes a big difference and is easier to do when you are initially setting up than afterwards.

I’m going to be in an out today, but I’ll try to check in to see how you are doing. But keep in mind there may be some lag time between responses. If anyone else can help out Claudio, I’d appreciate it.

so far it works all ok.

I just do not know where the hass_db is stored to check its size.

It should be in
/var/lib/mysql

but I cn’t access the directory with WINSCP, it gives me permission error (although I am inside with my pi user password)

Running MySQL on an SD Card will wear out your ad card pretty fast, but then again so does generating a 30GB SQLite file.

can you tell me how to minimize the database?

I find my database size by going to terminal and typing

mysql -u hass -p

then my password (hass is my mysql username)

then this for size, (just copy, paste and hit enter)

SELECT table_schema                                        "DB Name", 
   Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM   information_schema.tables 
GROUP  BY table_schema; 

I also installed phpmyadmin which make looking and searching mysql much easier.

https://www.phpmyadmin.net/

1 Like

1283 MB is the size, after what 1 hour …

you are building size really fast, do you use time as a sensor update entry?

I am not sure what is that.

Like what for example?

trying to install this now. I hope with that I can see what’s inside, and also delete the DB

When people create sensors they sometime have difficulty on how it updates. As a solution, they set this to time so it updates the sensor every second. This adds a lot to the database.

entity_id (Optional): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it’s state.

it is done here

I do this for quick delete and create a new HA database.

mysql> drop database DATABASENAME;
mysql> create database DATABASENAME;

1 Like

I do not think I have this.

But something I must have

I downloaded on my windows 10 machine. Have no idea how to start the program.

Damned I just want this **** database to not populate, and that’s it