SOLVED Upgrade of OpenEMR from 5.0.0 to 5.0.1 fails

hi, is the openemr mysql password something you created or was it created by the 5.0.0 package?

The openemr mysql password was made automatically by an openemr package. However, I believe it may have been made by a previous package, and passed down through successive upgrades. Unfortunately, I cannot check this as I don’t have a record of it before this reincarnation.

hi @rdh61 ,
Ensure your mysql openemr user has access to the mysql openemr database. What do you get when do this query in mysql:

SELECT * FROM mysql.db WHERE Db = 'openemr';

Also to clarify. Your current 5.0.0 is working just fine; it is the upgrade to 5.0.1 that is not working. correct?

mysql> SELECT * FROM mysql.db WHERE Db = 'openemr';
ERROR 1142 (42000): SELECT command denied to user 'openemr'@'localhost' for table 'db'
mysql> 

Yes, 5.0.0 works fine, but the upgrade process to 5.0.1 does not carry through.

what if you execute this on the mysql command line (you’ll have to login with mysql root)
GRANT SELECT ON mysql.db TO 'openemr'@'localhost';
and then retry below after logging out and then logging into mysql with openemr user

robert@robert-Lenovo-B590:~$ mysql -uroot -pMYPASSWORD 
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.26-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON openemr.* TO 'openemr'@'localhost';
Query OK, 0 rows affected (0,00 sec)

mysql>

BUT

robert@robert-Lenovo-B590:~$ mysql -uopenemr -pMYPASSWORD openemr
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.26-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT * FROM mysql.db WHERE Db = ‘openemr’;
ERROR 1054 (42S22): Unknown column '‘openemr’' in 'where clause'
mysql>

try just single quotes around openemr in where clause, it looks like they are backticks

OK, I guess one shouldn’t rely on copy and paste! Now I get:

mysql> SELECT * FROM mysql.db WHERE Db = ‘openemr’;
±----------±--------±--------±------------±------------±------------±------------±------------±----------±-----------±----------------±-----------±-----------±----------------------±-----------------±-----------------±---------------±--------------------±-------------------±-------------±-----------±-------------+
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv |
±----------±--------±--------±------------±------------±------------±------------±------------±----------±-----------±----------------±-----------±-----------±----------------------±-----------------±-----------------±---------------±--------------------±-------------------±-------------±-----------±-------------+
| localhost | openemr | openemr | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
±----------±--------±--------±------------±------------±------------±------------±------------±----------±-----------±----------------±-----------±-----------±----------------------±-----------------±-----------------±---------------±--------------------±-------------------±-------------±-----------±-------------+
1 row in set (0,00 sec)

mysql>

nice, try to upgrade again

Same result unfortunately.

was the above run after logging in with the openemr mysql user?

±----------±--------±--------±------------±------------±------------±------------±------------±----------±-----------±----------------±-----------±-----------±----------------------±-----------------±-----------------±---------------±--------------------±-------------------±-------------±-----------±-------------+
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv |
±----------±--------±--------±------------±------------±------------±------------±------------±----------±-----------±----------------±-----------±-----------±----------------------±-----------------±-----------------±---------------±--------------------±-------------------±-------------±-----------±-------------+
| localhost | openemr | openemr | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
±----------±--------±--------±------------±------------±------------±------------±------------±----------±-----------±----------------±-----------±-----------±----------------------±-----------------±-----------------±---------------±--------------------±-------------------±-------------±-----------±-------------+
1 row in set (0,00 sec)

sorry, above shows openemr user has privileges

was it the exact same failure?

Let me run through it again…

robert@robert-Lenovo-B590:~$ mysql -uopenemr -pG64WiuKPLE5h openemr
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.7.26-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT * FROM mysql.db WHERE Db = 'openemr';
+-----------+---------+---------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+
| Host      | Db      | User    | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv |
+-----------+---------+---------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+
| localhost | openemr | openemr | Y           | Y           | Y           | Y           | Y           | Y         | Y          | Y               | Y          | Y          | Y                     | Y                | Y                | Y              | Y                   | Y                  | Y            | Y          | Y            |
+-----------+---------+---------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+
1 row in set (0,00 sec)

mysql> 

Then try to upgrade…

Error:

“This package can not upgrade OpenEMR, because unable to confirm presence of a mysql credentials and/or database.”

Open emr install log:

lun may  6 22:09:24 CEST 2019: For upgrade, confirmed that the mysql database (openemr) and mysql user (openemr) exist
lun may  6 22:10:40 CEST 2019: MySQL 'openemr' database does not exist (or can't be accessed), unable to upgrade.
lun may  6 22:10:40 CEST 2019: EXITING..........

So yes, the same error.

Hi @rdh61 ,

What do you see in sites/ directory. I am willing to bet you have a default directory with your installation in it and then another directory there (likely was placed there if you tried to set up the multisite feature in the past; this is a feature that allows multiple installations from one place; each directory in the sites/ directory is checked to ensure it works in the ubuntu openemr package before it does the upgrade). If you remove the renegade directory (ie. the one that is not default) from your sites directory, then the upgrade should hopefully work.

Hi @brady.miller,

You would have won the bet.

In my sites/ directory I did have two directories: ‘default’ and ‘default.BAK_fresh_install’. The latter was the default directory put there by the fresh installation of OpenEMR on this machine. I had changed the name from ‘default’. The former is the one put there when I restored my OpenEMR backup.

I have now removed ‘default.BAK_fresh_install’ and successfully upgraded to 5.0.1-4.

1 Like

@stephenwaite and @brady.miller

Thank you both very much for your generous help!

Will it be safe now for me to do an automatic upgrade of my Lubuntu system to 18.04 LTS?

now that you’re practiced in backing up and restoring why not? you’ve got a backup of your new 5.0.1, right :slight_smile: