MariaDB on Synology

Morning all,

I’m trying to get the db away from the SD card on the pi and using MariaDB on my Synology as described in a tutorial on this board, as I’m all thumbs concerning this stuff.
It’s not working, and I’m trying to troubleshoot. I can’t however find where the Synology stores the data on the NAS. I don’t see a subdirectory or file anywhere through regular means.
Where does the Synology put its mariaDB database ?

Thanks,

Pete

This might be more of a question for the Synology forum. And also why would you look at the files? Isn’t it easier to connect to the DB with a client and check the contents of the tables?

How did you install this? I use Docker and when not defining a volume it is within the container /var/lib/mysql

I used the regular Synology package with myphpadmin as described in the post here.

The Synology answer is :slight_smile:

‘If your files are being stored in MariaDB that is running on the NAS rather than as separate files being referenced by another program, the way they are stored is actually a little different. MariaDB keeps its databases internal to itself and not on folders within volumes on the NAS’

Which is not very helpful.

I want to know whether it’s working. It is very difficult to troubleshoot a problem if you don’t know where the information is.
As for ‘connecting to the dB with a client’ : same answer.

Pete

Again it depends on how you set it up
I use a docker version on Syno and my files (! yes) are outside the docker container

What part is “not working”? Did you enter correct data in congiruration.yaml and restart HA?
You won’t be able to explore it like in a file explorer… it’s sql database, so sql program is needed. On synology install add-on “phpmyadmin” and you’ll be able to explore database. You’ll have to learn a bit of sql language, though.

recorder:
  db_url: mysql://root:[email protected]:3306/homeassistant?charset=utf8

Insert your pasword and IP of your synology. Also make sure that port of your mariaDB is 3306 (otherwise change it accordingly in above line).

You are right…that is the actual (!) question :slight_smile: …not where files/db are stored

I’m going round in circles here. I’m asking where the files are stored. If you don’t want to help, fine. But please don’t try to tell me ‘what I should be asking’. You are only complicating my problem.

@prontocek : that is indeed what I have done (only the user is not called ‘root’). I’m trying to determine if there is indeed a dB being built. The dB is made and exists according to myphp, but I can’t see if there is anything in it.

If you entered needed (and correct) data in configuration for new db location, then you look in HA’s history. If there’s data for the past there, then data is also inside new database. Or, as said: login into phpmyadmin, homeassistant and in sql tab enter:

select * from states where 1

and hit alt+enter; or, if you wanna search for particular entity:

select * from states where entity_id='sensor.id-of-your-sensor'

Don’t worry, you can’t break anything with commands, starting with “select”…

If you get results (entities) then it’s there. There’s no point in searching for “files”, since acutal files are not reachable to human user, only via admin console. In phpmyadmin you’ll also see database growing (size in kB/MB/GB) - just click on homeassistant on the left and in right window you’ll see tables and their sizes.

And, there’s no need for bad mood, bad attitude or anything similar. People are just trying to help. And your question was kinda “cloudy” - it’s not clear what you wanted to ask, since you said that “it doesn’t work”, but then again: “indeed dB is being bulit” (which means that it does work…).

I gave you my feedback but you are not answering, chiming out now after this comment

You can browse inside tables with myphpadmin, can’t you?
If you don’t see any tables, then the connection isn’t properly made.

Do you see errors in HA logs?
Isn’t synology the one using 3307 as the MariaDB port?

You can SSH to it, then run:

$ mysql -u root -p

Enter the password for MariaDB root user, then run:

MariaDB [(none)]> select @@datadir;

My is: /var/packages/MariaDB10/target/mysql/

To exit:

MariaDB [(none)]> exit;

My related post:

Synology DS218: MariaDB 10 enabling remote connection.

Thank you ! I’ll try tonight.

Pete

Unable to Connect after Warm Reboot

I’ve successfully been using MariaDB running on my NAS for better performance and limit SSD wear on my Home Assistant machine.

I can get the recorder to connect from a COLD restart, aka System → Restart. However if I restart via Developer Tools the recorder will not reconnect.

If I move the secrets file to point back to the HASS.io MariaDB Add-On, the recorder works.
Changing back to the NAS MariaDB fails.

Any ideas?

tiny keyboard lots os mistaks

I used mariadb for quite a while, too, back then it really was better regarding performance and reliability, but now it’s not anymore. A few months ago i changed back to built-in database and it turned out that it’s quicker than mariadb (history fills up faster), and so far it’s reliable, too. It was said that a lot was being made on improving sqlite in the past months, so it seems that it’s true.
If you have ssd you don’t have to worry about wear, that’s only in the case of using sd card.