Restoring openemr

I am using to backup both www/mysql openemr ( backup.pgp/bckup.pgp), I created the encryption key and .gnupg is in both /root/ , /home/openemr directories

I was able to decrypt and untar backup.pgp and the directory is there .

was able to decrypt ( no need to untar mysql file) bckup.pgp , it overwrites outpufilename using the key phrase successfully.

When trying to restore database:
mysql -h localhost -p openemr < outputfilename
it asks for password.
in the new machine I am restoring to I tried in mysql the user password , root password, key password, always I get:
ERROR 1045 (28000): Access denied for user ‘mohammad’@‘localhost’ (using password: YES)
I’m using OpenEMR version
mohammad is user in mysql.

what I need to do to restore database?

I will rephrase my question to be more precise:
Using Brady’s script I understand I need manually to place the two files
is there any way someone links me to where to place them?
it is easy of the www file it will go under /var/www/html/openemr and the directories are restored…I did that.
where does the mysql ( from bckup.pgp) goes?
Any links
this method of backing up and restoring is very secure and free, also I do not have to rely on servers and clouds, I am old fashion paper oriented I like records to be under my watch and this is the closest setup to my nature.

Bumping the post……………………….!

OK ……

Something is not right with the script, the size of the mysql_openemr_bckup.pgp is only 256 K, no way it should be at least 10 MB, when manually I generated the dump file it was 18 MB. so here is one problem I need to solve.

I removed the web directory of the old OpenEMR on the target machine to restore it ( kept the database)
reinstalled openemr fresh install ( since database was kept I had to change sqlconf.php
$host = ‘localhost’;
$port = ‘3306’;
$login = ‘UserNameInMyDB’;
$pass = ‘PSWOfUserOfMyDB’;
$dbase = ‘openemr’;
$db_encoding = ‘utf8mb4’;
And I had to change 0 to 1 so I get to the login instead of setup.
ran the manual mysql dump file and successfully got all the records on the source machine to the target machine.

So troubleshooting the script why it was not getting the database?

Will work on it and update.

I am very happy to report the restore is successful with the script, it did output data , I was able to decrypt it and restore it, the glitch was with the path for the dump file.

credit to

And to

I was writing the wrong path for the .mylogin.cnf
I did keep it testbed1 in
mysql_config_editor set --login-path=testbed1 --host=localhost --user=root —password
while in the script it was
mysql_config_editor set --login-path=testbed --host=localhost --user=root —password
So I edited it back and it is running like a charm…. :slight_smile:

So now I have an automated backups to my DVD R at 1 AM every day and I can restore it with simple steps to the target machine if source goes bad …. cannot ask for better than that.