How do I delete the database on home assistant

How do I delete the database on Home assistant?

I’m getting “recorder could not start” errors and everything I’ve read tells me I need to delete the database and start over. How do I do that?

From what I’ve read I have to ssh to the raspberry pi on port 22222 to do this. I’ve set up and installed the public key and get into the system but where is the database file located? And what is the best procedure to delete it?

I get an ha > prompt.
I type: login
and get access to the file system but where is the db located?
And… should I stop HA before deleting the db?

Can someone point to any documentation or forum post with instructions on how to do this?

It’s hassio on a raspberry pi 4.

Stop HA first. The database is the file with _v2 In the name and it is in the same folder as your config file (config folder).

1 Like

For Home Assistant OS, login via ssh and then:

ha core stop
rm /config/home-assistant_v2.db
ha core start
7 Likes

So I upgraded and my recorder errors went away… I had rebooted before but it didn’t help.
A bit surprised that worked but I’ll take it.

Still Thanks for the help.

If you just updated to 114, that explains why it no longer has errors. A new feature was introduced that detects if the database is corrupted, HA will archive the database, create a new one, and continue loading. So your old database is there, just malformed and not in a recoverable state HA can do anything with.

And it appears to work very well. Up and stable again.

If it continues, this may solve your problem long term…

1 Like

thank you!

How to do so ? When I type the first line, of course HA stops so I cannot type the second line. I type it in the Advanced SSH addon

1 Like