Locked out of Openemr

We have an older Openemr that is not used very often but I need to look for information stored on it. I am locked out and tried to change the password using
update users_secure set password = ‘$2a$05$MKtnxYsfFPlb2mOW7Qzq2Oz61S26s5E80Yd60lKdX4Wy3PBdEufNu’ , salt = ‘$2a$05$MKtnxYsfFPlb2mOW7Qzq2b$’ where id = 1;

But I am still not able to login. I have admin access to the MYSQL database. What am i missing here? What commend do I need to use to enable the userid? The userids appear to be locked out even with the password change

I solved it! I had to enable the user in the User table and change the password expiration date.

1 Like

Hello, i might have similar problem. please share how and
where to go and what you did, Sincerely

If I remember correctly, I had to update the following tables.

  • users_secure - reset the password and SALT
  • users_settings - Reset password expires to “null” and userid expired to “0”

The passwords expired… I had no idea that they expiry time and should be changed every 3 months or so… Can you make password that’s more complex than that or assist me with reducing the password requirements.

Thank you

Please help. We have a log out problem like above… we can not log in with admin ( and another administrator user). Only regular users(non-administrative (two)) can log in,; we use WIN11, Oemr version 4.2.2 Xampp v3.2.1
PL explain how to run command in database to reset (steps to start please). Sincerely.

for versions < 6.0.0 need the salt

UPDATE users_secure SET password = '$2a$05$MKtnxYsfFPlb2mOW7Qzq2Oz61S26s5E80Yd60lKdX4Wy3PBdEufNu', salt = '$2a$05$MKtnxYsfFPlb2mOW7Qzq2b$' WHERE username = 'admin'

have to access a mysql prompt and choose openemr database

we are searching in xampp>mysql ?

thank you very much …we did ran mysql .exe with UPDATE users_secure SET password = ‘$2a$05$MKtnxYsfFPlb2mOW7Qzq2Oz61S26s5E80Yd60lKdX4Wy3PBdEufNu’, salt = ‘$2a$05$MKtnxYsfFPlb2mOW7Qzq2b$’ WHERE username = ‘admin’ and

still can not login with admin and pass…

Hi Loc Nguyen,

I faced same issue.then i changed globals tables after that its working fine. i attached 3 table for your reference. you can use these table . and keep backup your old table
globals.sql (15.0 KB)
users_secure.sql (3.1 KB)
users.sql (8.5 KB)

username: admin
password: pass

Thanks ,
Param,
help@capminds.com

1 Like

Thank you. What steps needed to be done? Do we copy over to ? :grimacing:

Do backup your globals,users_secure and users table. Then import these table in your database.And trying to login.I hope its working fine. :blush:

Are you sure ‘admin’ record in users table has status=active and password has not expired?
Maybe the login error message is telling something?

Hi MD Support: the ‘admin’ and another (administrative) user did not login and use the EMR for sometimes, could that cause both accounts to lock out? but 1. how do you check the active status of admin and the (administrative) user in the user table? 2. there was a required to change password every 3 months i think. Thanks.

You should be able to follow same steps you did earlier except this time run simple query on users table as

select username, pwd_expiration_date, active from users

By looking at all users, you should be able to compare working users with problematic users and eliminate the possibility that their password has expired or the account somehow was marked as inactive. If you can’t, you can share the output for someone to confirm active status and expiration date.

Thank you, will try that out when i get back.

Dear MD Support, please help for what to enter===>

C:>cd xampp/mysql/bin

C:\xampp\mysql\bin>mysql.exe -u root --pass
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.5.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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> UPDATE

???

Before anything, it is not a good idea to use ‘root’ user when working with command line interface. If you do not know the database user for your emr installation, you can find it in sites/default directory of the emr installation.

Then use

mysql.exe -u oeadmin --p oedb
where oeadmin is database user (worst case scenario it could be root) and oedb is emr database name (many setup instructions use openemr as database name).

After login you will be connected to emr database.

Then list all users with command from my prior post.

Dear MD support; we think both admin users password expired;
So we went ahead with ===>

C:\xampp\mysql\bin>mysql.exe -u root --password openemr

Then we had to=======>

Enter password: ****

It then gave us===>

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 5.5.32 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may b trademarks of their respective owners.

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

mysql>

We then enter

mysql> select username, pwd_expiration_date, active from users

Nothing shows up….>now we are lost……sorry, please help again

these are all the commands allowed to us:==>
List of all MySQL commands:
Note that all text commands must be first on line and end with ‘;’
? (?) Synonym for `help’.
clear (\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
notee (\t) Don’t write into outfile.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (#) Rebuild completion hash.
source (.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don’t show warnings after every statement.
For server side help, type ‘help contents’

there is NO select command