Backup and restore of openmer 4.1

ironstormtech wrote on Tuesday, October 11, 2011:

Hey guys I am a new openemr user and backed it up using the built it backup and that created a emr_backup.tar file.
How do I restore this openemr 4.1 on a new server seeing the previous server has crashed?

Thanks

bradymiller wrote on Wednesday, October 12, 2011:

Hi ironstormtech,

Depends on what operating system you are using.

-brady

nevillefm wrote on Monday, December 19, 2011:

Windows 7

nevillefm wrote on Tuesday, December 20, 2011:

I keep getting this message after I attempt restor
Check that mysqld is running.
ERROR: Could not connect to server!
Please let me know the correct procedure to restrore the emr_backup.tar to a fresh install on Windows7

bradymiller wrote on Tuesday, December 20, 2011:

Hi,
Lets start with how you tried to restore it? Will be nice to flush this process out for windows and get it documented on the wiki.
-brady

nevillefm wrote on Tuesday, December 20, 2011:

Great.
OS is Windows7
Here’s what I’ve done so far
1. Deleted the XAMPP folder (probably not required. But I was getting desperate)
2. Reinstalled xampp-openemr4.1 for windows
3. Opened the emr-backup.tar file with 7-zip (free download from 7-zip.org)
4. This shows three files in the folder - openemr.sql.gz, openemr.tar.gz, phpgacl.tar.gz
5. I treated them as follows
- openemr.tar.gz contained openemr.tar which had folders with the same names as in c:\\xampp/htdocs/openemr so I extracted them there.
- openemr.sql.gz has openemr.sql which I extracted to c:\\xampp/htdocs/openemr/sql
- phpgacl.tar.gz has phpgacl.tar which has folders with names (except for the ‘phpgacl’ folder itself) as in …openemr/gacl  so I extracted them there
6. None of this worked. I get this error message whenever I try to log in
‘Check that mysqld is running.
ERROR: Could not connect to server!’
7. If i undo all the above then I can login back to the pristine openemr. I tried extracting  the files one at a time and logging in after each. Problem seems to be with the openemr.tar.gz file

Would love to be involved with  documenting the whole thing on the wiki
Thanks

bradymiller wrote on Wednesday, December 21, 2011:

Hi,

You are correctly dealing with the openemr.tar.gz file :slight_smile:

Throw out the phpgacl.tar.gz file.

The openemr.sql is a special file for building your mysql database. To get this to work, generally will need to:
1) Create a openemr database in mysql (make it UTF-8 encodiing)
2) Create a openemr user in mysql (that has privileges to modify the openemr mysql database)
3) Then import the openemr.sql file into the openemr mysql database
4) Then ensure your openemr/sites/default/sqlconf.php credentials match the openemr mysql database/user you created
To do this, can be done via command line (a quick mysql tutorial on the web will generally show how to do this) or via gui, such as phpmyadmin.

However, in your specific case, you already have a mysql database/user with the new xampp-openemr pack you installed. So would recommend using phpmyadmin included in xampp to:
1. drop the ‘openemr’ database, and then create another ‘openemr’ database (it will now be empty)
2. then use import feature in phpmyadmin to import the openemr.sql file to the empty openemr database
3. replace current openemr directory with backup in openemr.tar.gz

hope this helps to get you started,
-brady

nevillefm wrote on Thursday, December 22, 2011:

Thanks Brady
I followed the steps for installing through phpmyadmin with the following problem
1. Could not ‘drop’ the openemr database. Could only drop all the tables. The database name ‘openemr’ remained with (0) tables. I imported the openemr.sql file to this
2. On attempting to login I get this error message
"ERROR: query failed: SELECT `setting_label`, `setting_value` FROM `user_settings` WHERE `setting_user` = ? AND `setting_label` LIKE ‘global:%’

Error: Table ‘openemr.user_settings’ doesn’t exist"
Thanks in advance

bradymiller wrote on Thursday, December 22, 2011:

Hi,
What was the version of OpenEMR that you backed up from?
In phpmyadmin, how many tables are in the OpenEMR database?
-brady

anonymous wrote on Wednesday, December 28, 2011:

I know that this may be out of sequence in this thread but am having problems with restore.  Running mint 12 oemr 4.1 with all patches.  Is there a new restore script and could someone document some detailed steps.  Am presently using daily image backup but this is very time consuming.

nevillefm wrote on Thursday, December 29, 2011:

Got my data back. This is the route I took
1. Reinstalled xampp-openemr4.1 for windows
2. Opened phpadmin from c:/xampp/xampp-control (right click and chose login as admin) > mysql > admin
3. Dropped the openemr database
4. Imported backup database ‘openemr.sql’ from the emr-backup.tar file.

With this I can access and use all the data with my previous settings when I login at localhost/openemr. No visible problems since I started using it yesterday

Note:
I have not restored the openemr.tar.gz file to /htdocs/openemr. When I try that I get the error message

‘Check that mysqld is running.
ERROR: Could not connect to server!’

So far running fine with only the openemr.sql file. What problems are likely?

OpenEMR I backed up from v4.1.0 (3)
No of tables 147

tmccormi wrote on Thursday, December 29, 2011:

Unless you had custom changes to the code, or forms that are not the defaults installed,  that will be fine.  If you had scanned or upload documents, you need to extract them into the sites/…/document dir, same for anything in the edi and era directory and perhaps the openemr/library/freeb dir.
Tony
www.mi-squared.com / @tonymi2
oemr.org / @OEMR_org

nevillefm wrote on Friday, December 30, 2011:

Thanks Tony
The documents were already there. So I guess the openemr.tar.gz file extraction was partially successful. We use CAMOS and the other default forms. I’m running this installation from my laptop for a few days. Will then do a final backup onto the server. 

nevillefm wrote on Monday, January 02, 2012:

Problem with the calender. On login in the morning it opens to the previous day. Opens correctly on login after noon. Something to do with a time zone setting somewhere? Rechecked settings in globals but couldn’t correct this. Any solutions :? Thanks

yehster wrote on Monday, January 02, 2012:

There is also a timezone setting in php.ini
http://us3.php.net/manual/en/datetime.configuration.php#ini.date.timezone
Perhaps changing that will fix your issue.
Kevin Yeh
kevin.y@integralemr.com

nevillefm wrote on Wednesday, January 04, 2012:

Thanks Kevin
That did it. Worked like a charm
Thanks again

nevillefm wrote on Sunday, January 08, 2012:

Did a backup and restore again. No problems with  the openemr.sql and openemr.tar files. All working fine, Now to put it all down! Thanks Brady, Tony, Kevin.