Proper procedure for backups and restores?

Hi I’m running OpenEMR 5.0.2 on Ubuntu and was wondering what the proper procedure is to backup and restore.

As of now I’m doing a mysql dump and backing up the openemr dir with Borg. When it comes to restoring I ran into issue with simply running the mysqldump file.

Is there a proper way to do this?

Thanks

Hi Amrit. I’m getting up to speed with Linux and OpenEMR but have been getting help from a guy who did our migration from 4.1.2 to 5.0.2. What commands are you using to do the mySQL dump and what result are you getting? It’s possible Borg may be the problem.

Im using mysqldump to create the dump file. The result is an sql file which can be used to recreate the original sql databases.

The issue I have, is that when I restore the database, and copy the the openemr directory, none of the password + username combos work anymore. Id imagine something is getting changed with the password hashing or something but I dont know how to fix it.

Try deleting the two files sites/default/documents/logs_and_misc/methods/sixa and sixb

Then log in.

OK. Here is the process that I use when taking a backup of a customer’s current database and uploading to my own.

First I make a backup of the database using mysqldump.

I go into mysql using my credentials

In this case I am going to take my backup and store it into a new database called openemr2.
I create the database using the command: create database openemr2
I specify with the term “use” so I can set the database I will store the dump to user openemr2
Then I specify the sql file I want to populate the DB with using source 2020_10_13_openemr.sql

If you are trying to upload a copy to a different machine or a different instance, you will want to remove the keys as Steven suggested. If you are on the same instance, you should not have to worry about it.

Now: If you change the database name you will have to update the mysqlconfig file and have it point to that directory. it will be in the var/www/openenmr/sites/default/sqlconfig.php file. In this case I will need to fix the login, pass, and dbase variables (this paricular snapshot is from my repo, not live site)

thanks, I’ll give that a shot

Yup thats what I do as well, I am testing this out on a separate machine so I’d imagine its a key issue like you guys suggested. I’ll give that a shot and let you guys know.

Thanks for the help!!

Yes. A few things since you are on a new machine. If you are not able to log in (getting incorrect password / username) then the issue is related to the sqlconf.php file.

Once you are able to log in, you will still have the key issue. From what I gather ( @brady.miller can help explain), you have two choices. You can delete the keys at Steve suggested or you can copy the keys from the original instance file and replace the keys in the development instance.

I haven’t tried replacing the files, but it sounds like it should work.

Hi,

There is a lot easier way to backup and restore Openemr. You can use Abeeka backup solo https://www.akeeba.com/products/akeeba-solo.html

I had used this method when moving between different webhosts. It is so much easier using graphic user interface rather than remembering and typing all the command keys into Ubuntu or etc.

After that, all you need to do is to change the details of database name, login and password to match your current database details in openemr/sites/default/sqlconf.php

<?php // OpenEMR // MySQL Config $host = 'localhost'; $port = '3306'; $login = 'admin'; $pass = 'password'; $dbase = 'openemr'; //Added ability to disable //utf8 encoding - bm 05-2009 global $disable_utf8_flag; $disable_utf8_flag = false; $sqlconf = array(); global $sqlconf; $sqlconf["host"]= $host; $sqlconf["port"] = $port; $sqlconf["login"] = $login; $sqlconf["pass"] = $pass; $sqlconf["dbase"] = $dbase; ////////////////////////// ////////////////////////// ////////////////////////// //////DO NOT TOUCH THIS/// $config = 1; ///////////// ////////////////////////// ////////////////////////// ////////////////////////// ?>

I hope this help.

Good luck!