There are a few steps needed to get persistence working with OH. It does take a little bit of time to completely get your head around it though. So start by reviewing the information here; https://www.openhab.org/docs/configuration/persistence.html#persistence-configuration
Maybe like me you need to be lead by example, as that usually puts things into context. I’m not able to access my OH configuration at the moment so limited in able to help, but will be able to offer my very simple setup later on when I’m home.
Like with everything in OH persistence is very flexible. First, choose the database engine you want to use. For me that’s MySQL and influxDb. I’m using Grafana to graph a few items and follow follow this thread. If you decide to use MySQL then use the JDBC Persistence for MySQL as this seams to be very stable in my setup.
For the persistence to work you will need to configure the connection string as per the details here. Make sure the user account you use to connect to MySQL has permissions to both create and update existing fields and columns. The lazy way being to provide the user with full access, which is find in a closed environment.
To make sure that you have everything in place I would open a second console and “tail -f” openhab.log. This way if someting hasn’t been configured correctly then you’ll get an error here and can capture it. Very useful for when answering further follow up questions.
Once you have your database in place and don’t have any connection errors it’s time to get your database populated. This is where the persistence/mysql.persist files comes into play. What you need to do is save every change and restore that on a restart. This section will help you.
I hope that provides you with some direction and will update later with better real world examples from my setup.