Please i need help over backup and restore

aterad wrote on Wednesday, September 17, 2014:

i backup my data by using the openemr backup module. in trying to restore it i encountered serious problems and it gave me this error

ERROR: query failed: SELECT * FROM lang_definitions JOIN lang_constants ON lang_definitions.cons_id = lang_constants.cons_id WHERE lang_id=? AND constant_name = ? LIMIT 1

Error: Table ‘openemr.lang_definitions’ doesn’t exist

this is what i did in restoring:
i unziped the .tar backup file which gave me 3 other files.
1.openemr.tar file 2. the openemr.sql file 3. phpgacl.tar

i unzipped openemr.tar and copy it to the existing xampp/htdocs/openemr folder and i also unzipped the openemr.sql and i deleted the existing openemr database, created a fresh openemr and imported it.

but when i tried accessing the openemr through localhost/openemr it gave me the error above.

i am using windows7, xampp 1.81 and openemr 4.1.2(4)

please help me out

fsgl wrote on Wednesday, September 17, 2014:

Try restoring database via command line:
mysql -u root -p[root_password] openemr < openemr.sql

Another way to backup & restore described here.

aterad wrote on Thursday, September 18, 2014:

@fsgl, thanks for your help. the first option you gave, i dont know how to go about. Please can u be more explicit,thanks.
As regards the 2nd suggestion,that will be good for a fresh copy of backup but i will need the 1st option to restore back. Pls help

visolveemr wrote on Thursday, September 18, 2014:

  • Open up a windows command prompt.
    • Click Start -> Run
    • Enter “cmd” into the dialog box and click the “OK” button.
  • Go to the directory that the mysql client utility is located.
    • (Example) cd C:\Program Files\MySQL\MySQL Server 5.5\bin
  • Import the dump of your database or table.
    • Run the mysql.exe program using the following arguments.
    • mysql –u[user name] -p[password] -h[hostname] [database name] < C:[filename].sql

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com
Demo’s @ ViSolve Demo Library

fsgl wrote on Thursday, September 18, 2014:

  1. If the old xampp folder has not been deleted & you are restoring to the same machine, rename it oldxampp.
  2. Extract the openemr.sql file if it has the .gz extension at the end of the file name.
  3. Go to Windows Explorer, copy & paste the .sql file to C drive. It should be the last item in the list of folders.
  4. The command line in Windows is called Command Prompt, 2 ways to open it.
  5. At the flashing cursor, type the following & hit Enter:
    CD C:\
  6. When the flashing cursor appears again, type this, (no space between p & root_password) & hit Enter:
    C:\mysql -u root -proot_password openemr < openemr.sql
  7. If you don’t remember the mysql root_password, it should be in C:\xampp\security\security\mysqlrootpassword.txt.
  8. Go to Xampp Control to turn on Apache & MySQL.

nursejeff wrote on Monday, December 22, 2014:

fsgl,

I had the same trouble as Timothy

I tried your above suggestion, I even cut and pasted your command above and got this error: C:\mysql is not recognized as an internal or external command, operable program or batch file.

Any other suggestion?

Thanks

Jeff

fsgl wrote on Monday, December 22, 2014:

Timothy was using Windows 7. I thought you have Linux.

Are you able to restore with the script described here?

fsgl wrote on Monday, December 22, 2014:

O.K., saw other thread.

nursejeff wrote on Monday, December 22, 2014:

Does the password need to be in the square brackets? [ ]

Jeff

fsgl wrote on Monday, December 22, 2014:

No.

If you are using Visolve’s suggestion, be certain to use the correct username & password found in sqlconf.php.

No luck importing with root password or reset root password?

nursejeff wrote on Monday, December 22, 2014:

I looked up the passcode in the sqlconf.php under xampp>htdocs>openemr>sites>default.

It had a passcode I’d never seen before so I tried it in the command you gave above.

It still gave the same error: C:\mysql is not recognized as an internal or external command, operable program or batch file.

Jeff

yehster wrote on Monday, December 22, 2014:

Open the xampp folder with the windows explorer and do a search for “mysql” that will show you which directory the mysql.exe is in.

fsgl wrote on Tuesday, December 23, 2014:

Just realized I had misled you. Sorry.

The MySQL root password & the password in sqlconf.php are from Windows, not Linux. Good that you knew to look in the Windows default folder.

Did you do the following?

  1. copy & paste openemr.sql to C-drive.
  2. check in Windows Explorer that the file is actually there.
  3. first command: CD C:/
  4. second command: mysql –uopenemr -ppassword -hlocalhost openemr < C:openemr.sql

There should be no apostrophes in password.

fsgl wrote on Tuesday, December 23, 2014:

In the other thread, Visolve made a very good point.

When import via phpMyAdmin was first attempted, the lang_definitions table went missing, so the effort failed.

PhpMyAdmin can be a finicky creature. Subsequent attempts to correct the initial error may turn out to be more trouble than it’s worth.

If you are still stymied, let’s start anew.

  1. Delete the entire xampp directory in Windows.
  2. Reinstall the package.
  3. Increase memory_limit to 512M.
  4. Re-do steps 1 through 4 from above with the new password from sqlconf.php in Windows.

nursejeff wrote on Wednesday, December 24, 2014:

I don’t mind deleting and staring over but I have a couple of questions.

  1. Does the version of mysql database make a difference when trying to transfer the data to the new computer. My Linux machine is over 3 years old, so the versions of MySQL are 3 years old also.

  2. My openemr.sql file is 672,535 KB in size (665MB). Is this too big? I have over 3 years of data. The php.ini default of upload_max_filesize = 30M seems small.

Jeff

fsgl wrote on Wednesday, December 24, 2014:

  1. No.
  2. Perhaps. If 512M is too small, we’ll know soon enough.

N.B.: no space between u & openemr, p & password, h & localhost.