Check that mysqld is running after restore

docna wrote on Wednesday, February 18, 2015:

Hi,
I am trying to restore openEMR form a backup after my working database that was hosted on a web server got corrupted and I could no longer log into it.

So I installed the xampp 4.1.2 version of openEMR in my laptop running Windows 7 (because the original database was not updated to the new version) and I restored to it a backup that I had done earlier from the hosted one. Problem is that when I try to log into it Firefox displays a message about checking that mysqld is running. It is running, since it is listed listening to port 3306 on the resource monitor and the XAMPP control panel says that the service is running so I don’t know if there is a setting that I should change because the backup is from the hosted version and I am restoring to my local computer.

My plan was to export the users_secure table, that the hosted version lost, from the backup and import into it so I could log in again. Thing is that the restore proceeded correctly because I can see all the tables and data on Myphp and I actually exported the table, but when I tried to import into the hosted one it said that the users_secure table did not exist.

I proceeded to create the table based on the table structure in the backed up local copy of openEMR but that didn’t do any good. Myphp displays error message #1146 table doctorna_openemr.users_secure’doesn’t exist when I try to save the table.

So I am stuck. I cannot use the restored copy and cannot log in into the production, online database.
What could cause the message on firefox and How could I import that missing table into the hosted one?

I appreciate any help and orientation that someone could give me.
Thank you.
E. Navarro

visolveemr wrote on Wednesday, February 18, 2015:

Hi Navarro
Reg the mysqld error, kindly check whether you have the correct configurations in the file ‘sites/default/sqlconf.php’ and your mysqld service is running.
While trying to import the table into your hosted server, was there any error and when you obtain the error ‘table doctorna_openemr.users_secure doesn’t exist’. Such information will help us to assist you.

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com | Phone: 408-850-2243
Demo’s @ ViSolve Demo Library

docna wrote on Wednesday, February 18, 2015:

Thank you for your reply. I really appreciate your help.
I did change the lines $login and $dbase from doctorna_openemr to just openemr because the web hosted database was appended with doctorna when I created it but the local one didn’t. Besides that I didnt change anything because I don’t know if I something is wrong. I did notice something odd: the password entry line has an ‘&’ added after a number so it is not what I type. But I cannot go as far as getting the login page yet.

I checked in windows services and mysql is nunning and listening to port 3306 on the resource monitor.

This is the content on the file:

<?php // OpenEMR // MySQL Config $host = 'localhost'; $port = '3306'; $login = 'openemr'; $pass = 'opEN61&mr'; $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; ///////////// ////////////////////////// ////////////////////////// ////////////////////////// ?>

Regarding the import of users_secure table into the web hosted db the message after trying to import the table is:

#1146 - Table ‘doctorna_openemr.users_secure’ doesn’t exist

I did check that, while exporting from the local copy, structure and data were included. I don’t know why it does not import it.

Again, thanks for your help.
E. Navarro

blankev wrote on Wednesday, February 18, 2015:

Check the name of the OpenEMR directory. This is the location and the name where you should point your browser.

If it is named OpenEMR-4.2 point it to localhost/openemr-4.2

This is important for webhosting, but also for the local machine. It has nothing to do withthe name of th data-base.

If the localhost/directory is localhost/doctor/Dr.Arnab point it to that directory. ( /Dr.Arnab can be also /openemr and probably it can also be capitals sensitive)

visolveemr wrote on Wednesday, February 18, 2015:

Navarro,

The $login and $pass are the credentials to login to mysql database

Please try to login to the mysql by following the below steps for windows,

cd c:\xampp\mysql\bin
mysql.exe -u openemr -p opEN61&mr;

if you are not able to login then there is no user in your mysql database. Make sure that openemr database is accessible with the specified username and password and change that same in sqlconf.php.

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com | Phone: 408-850-2243
Demo’s @ ViSolve Demo Library

docna wrote on Thursday, February 19, 2015:

Peter,

Thanks for your reply. I checked the directory on which openemr is and it is c:\xammpp\htdocs\openemr. There is no version number appended, just openemr.

Should I change the name to something elese? Maybe add htdocs.openemr?

Thanks again for your interest in helping me.
E. Navarro

docna wrote on Thursday, February 19, 2015:

VSolve,

I couldn’t log in following your instructions. Then I changed the $login and $pass lines on the sqlconf.php to the ones I used to log in to the database. No luck either. I went to phpMyadmin and checked the users table and it lists me as a user with the name I changed on the sqlconfig file but on the password column it says “no longer used”.
Then in the users_secure table again, my user name “enavarro” is listed but the password is a long series of letters, symbols and numbers. I am not sure but I think I saw this entry and it was the password, opEN61mr.

Could the restore that I did corrupted some information? What could be causing this? Of course when I did the backup I could log in.

Thanks again for your help.
E. Navarro

visolveemr wrote on Thursday, February 19, 2015:

Hello Navarro

On analysing your issue again, basically there are two problems we are talking about:

  1. Cannot able to login into the local OpenEMR instance
  2. Cannot able to import “users_secure” table in the hosted machine

For the 1st issue, please make sure whether you have installed your openemr instance in localhost. Change the $config value to 0 in sqlconf.php file, and install the instance as fresh in local.
This will resolve the issue of logging in localhost openemr instance.

If you have the database backup(example: openemr.sql file) taken from hosted environment, then you can restore the database from this backup , by following “Restore openemr database” heading given here.

Regarding the second issue, After resolving the above mentioned localhost issue, please do try exporting the table again and import in the hosted machine. The import will automatically creates that table, if that does not exist and no need to do that manually.

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com | Phone: 408-850-2243
Demo’s @ ViSolve Demo Library

blankev wrote on Thursday, February 19, 2015:

Be sure Apache and MySql server are running.

Be sure the main folder of openemr has no sub folder also named openemr.

Something like:

c:/xampp/htdocs/openemr/openemr/

If this all seems working, best thing to do is Delete all also Apache and MySql DB and do a complete re- INSTALL. (for the local machine)

fsgl wrote on Thursday, February 19, 2015:

Restoring OpenEMR to localhost is relatively simpler than repairing hosted copy. After this has been accomplished, we can then tackle the latter task.

There appears to be a bit of confusion about the various sets of login credentials. The database & the application share the same name, adding to the confusion.

There are 2 sets of credentials for the the database, namely one for the user, root, & that specified in sqlconf.php. The user can deploy either set to gain access to the database via phpMyAdmin. If no password has been specified for root, it would make things much easier; so don’t set a password for root in the setup of OpenEMR on localhost.

The login credentials for OpenEMR, the application, are completely different from those for the database. Of course, those for login to the host will not work for localhost. The passwords in the users_secure table have been encrypted causing additional problems. The solution is to reset the password for the user, admin, back to “pass” for easy login.

Would suggest the following:

  1. Make a new start by deleting the entire xampp directory. You will need to stop Apache & MySql first before the deletion.

  2. Install the 4.1.2 Package & patch to 7. You can upgrade to 4.2.0 at a future date.

  3. Extract the web directory from your backup & copy over as described here.

  4. Place openemr.sql in C-drive & run these two commands in Command Prompt.

CD C:\
C:\xampp\mysql\bin\mysql -u root -p openemr < openemr.sql

  1. Go to xampp-control to start both Apache & MySQL.

  2. Go to the 2099 Demo, users_secure table; copy everything for user, admin, id 1. See screenshot.

  3. Point your browser to localhost/phpmyadmin. If no root password has been set, you should be able to login with no password. See attachment phpmyadmin.png.

  4. Paste all the column entries from the 2099 Demo to your users_secure table. Delete all other users. You can add them back later.

  5. Login with admin & pass.

fsgl wrote on Friday, February 20, 2015:

Steps 6 & 8 can be simplified by exporting the .sql file from the 2017 Demo & then importing into localhost.

It is necessary to truncate users_secure in localhost first (remove all data from the columns, but not delete the table itself) because with another user, admin, id 1; phpMyAdmin will not import the .sql file.

docna wrote on Sunday, March 01, 2015:

fsgl,

Thanks for your efforts in helping me.

I’m sorry for my delay in replying but I was out of town for a meeting and didn’t have the time to implement the changes that you suggested me. Today, I finally got to try your suggestions and I did up to point 6: When I click the link for the 2117 demo, I go to the login page of the demo but I don’t know how to get to the users_secure table to export or copy it.

After restoring, I thought that maybe I could have exported the users_secure table contents from the clean database that gets installed with the xampp package before restoring but I am not sure if this would work as the demo.

I could login to the new database that was installed with de 4.1.2 package but, as soon as I restored the “Check that mysqld is running” message reappeared when I tried to log into it. So something in the restore prevents me from even displaying the login page.

What can I do now? Is this password problem the reason for the “Check that mysqld is running” message appears even if I don’t even get the login page?

Thanks again for your help.
Sincerely,
E. Navarro

docna wrote on Sunday, March 01, 2015:

Hi, ViSolve.

I was out of town in a meeting and I couldn’t try your suggestions until now.
I deleted and reinstalled the xampp package and I was able to login to it without any problems. Then, I restored from my backup following the instructions and after that the “Check that myqld is runing” message reappeared on a blank page (no login page).

Even if I cannot login to this restored copy of my database, the users_secure table is there, populated with the two users that I had so the purpose of restoring got accomplished. Now the problem is that exporting this table and importing it to the hosted (and most updated but not working because the users_secure table does not exist) is not possible: when I try to import it using phpmyadmin on the hosted site I get the error: #1146 - Table ‘doctorna_openemr.users_secure’ doesn’t exist.

Any ideas of how can I import the users_secure table to the hosted copy?

Thanks again for your help.
E. Navarro

blankev wrote on Sunday, March 01, 2015:

In the latest versions of OpenEMR there are two tables that should be in Sync. Same Key-id for the connection.

Your doctorna_openemr.users_secure (CAPITALS and lower case letters should be the same as for the "dot/point " and " _ " characters)

The other important table is:

doctorna_openemr.users

This table has the names and other permissions and settings except for the passwords. So if you have no permissions, since the ID goes to the wrong password, you get all kind of errors.

Till tomorrow before automatic reset you can see the added user: pwb and the different connections in the tables:

http://demo.open-emr.org:2104/openemr/interface/login/login_frame.php?site=default

It is only a small set of rows so it is easy to understand.

Another important issue are the phone numbers and addresses these are also stored in key-id related tables.

To import without resetting the the User and Password for the original Administration-user skip the first row of information just below labels of the table when importing. This results in at least having a basic administrator that can give the correct passwords back. Also never delete the first row of both tables if possible.

visolveemr wrote on Monday, March 02, 2015:

Hello Navarro

For exporting the ‘users_secure’ table and importing that using phpmyadmin method, make sure you have followed the below steps.

  1. In the local phpmyadmin select the correct database and the table ‘users_secure’ that need to be exported.

  2. select the Export option of this table and save that backup file.

  3. In the hosted phpmyadmin select the database to which the table needs to be imported.

  4. Select ‘Import’ tab and upload the backup file and click ‘import’.[This backup will - create the table automatically, even if it doesn’t exist]

The other method is to use the command line mysqldump method, to backup and restore the database. For backing up, use the following command in the command prompt:

$ mysqldump -u [uname] -p[pass] [dbname] [tablename] > [backupfile.sql]

This command will backup the mentioned table and save that file in the mentioned path. To restore back the same in the hosted machine, use the following command:

$ mysql -u [uname] -p[pass] [dbname] < [backupfile.sql]

Thanks
OpenEMR Customization/Support Team,
ViSolve Inc
services@visolve.com | Phone: 408-850-2243
Demo’s @ ViSolve Demo Library

fsgl wrote on Monday, March 02, 2015:

Let’s try to get access to your localhost before attempting to fix hosted copy.

For some unknown reason the login credentials of your two users no longer work. Instead of trying to fix them, it is far simpler to replace those credentials with admin & pass.

Because the passwords are encrypted & you don’t know the “secret code”, it is a lot simpler to deploy the “secret” password in its encrypted form from the 2099 Demo.

To make things even easier, I have exported the users_secure table from the 2099 Demo for your convenience. See users_secure.sql.

Go to phpMyAdmin as described in Step 7 above & delete your 2 users from the users_secure table.

While in still in the users_secure table, click the Import table, browse to the location of the .sql that I had prepared for you & click the Go button. See import.png.

If you are still unable to login with admin & pass to localhost, go back to your phpMyAdmin. Be certain that the users_secure table is exactly as depicted in attached screenshot.


Username, admin (id = 1), should have in the password column,

$2a$05$lYz.msKv/mT41jP//.cV9.spnhASPbLiBzdpXVfDXS8v.U7xGSvzO

while the salt column should have:

$2a$05$lYz.msKv/mT41jP//.cV9$


If you don’t see these 2 entries in the users_secure table, copy & paste them into your respective columns & save

docna wrote on Monday, March 02, 2015:

Good morning fsgl,

Before anything else, thank you again for your help.

I followed your instructions without any problem; checked that the entries on users_secure were just like the screenshot (except for the last update that had yesterday’s date). Tried to login and, again, got the blank page with the “check that mysqld is running” message. The login page is not displayed. The msqld service is stated as running on the services page.

By the way, I also tried to import the users_secure table that you sent me to my hosted database that is missing the users_secure table. I got the same “#1146 - Table ‘doctorna_openemr.users_secure’ doesn’t exist” message that I got when I exported the users_secure table from the restored version.

There is something else that is preventing the display of the login page and that was introduced by the restore of the database. Before that the login page was displayed and I could enter the admin and pass credentials successfully.

I don’t know if things could work the other way around: exporting the patient and encounter data from the hosted copy to a fresh local copy of openemr. Would that be possible?

Hope you have something that I could try. Thanks again for your help.
Efren

docna wrote on Monday, March 02, 2015:

Good morning ViSolve,

Thank you for your help.

I followed your instructions to the letter, exporting the table and then importing into the hosted database. I got the same “#1146 - Table ‘doctorna_openemr.users_secure’ doesn’t exist”.

I did even try to create the table using exactly the same columns that were in the local copy but it wouldn’t let me save that table. I don’t understand why.

What could be the reason for this?
Thanks again for your time.
Efren

docna wrote on Monday, March 02, 2015:

Pieter,

Tried to open the demo with the link in your post and I got the same message that I get when I try to open mine: “check that mysqld is running”. Checked into the services and noted that, in fact, mysql servide is running. What could be causing this?

Thank you for your help.
Efren

blankev wrote on Monday, March 02, 2015:

This is very strange! INDEED!.

All Demo work on the Internet and has nothing to do with your browser or your local computer. Could it be something like malware or redirect virusses?

Why would your BROWSER check if MySQL service is running if no other program is asking for MySQL Services.
One of the many options could be to check your computer: