Unable to login after new install

Hi. I’ve just installed OpenEMR for the first time, to explore the possibility of using it for a small ayurvedic treatment facility in our spiritual retreat centre. After completing the setup (I’ve taken a printout of the final setup summary page), I reached the login page. Time and again, I entered the correct username and password, but it says “Invalid username or password” every single time. I’ve verified that my caps-lock isn’t on, and I’ve cross-checked more than once with the printout that I’m entering the correct credentials. If it’s easier that way, I don’t mind changing the username and/or password. Thanks in advance.

Warm regards,
Anand S

OpenEMR Version
I’m using OpenEMR version 6.0.0

I’m using: Google Chrome 96.0.4664.45 (Official Build) (64-bit)

Operating System
I’m using: Windows 11

Did you check the logs?

I’m sorry, I don’t know how to check the logs.

So I was going through the following topic: Unable to change ADMIN password

I tried the solution provided in the accepted answer, where I changed the password to $2y$10$6nlFnmFSwPYq/y7E8jhbX.ijYCIX7M4J9cmkQupzs.uHm4z8F.x7O. I assume this translates to pass, which didn’t work. Did I assume wrong? Or is this dependent on the username?

I’m so sorry - I just noticed that the post mentions the solution to only work for the user admin. Is the process of changing the admin username as simple as changing username in users_secure and users?

hi @magnetar47 , you can change the name of the user in the sql query which will set that username’s password to pass.

Hi! Thanks for the response. If you could walk me through the process, that would be greatly appreciated. Basically, my problem is that I’m not able to login to OpenEMR after a fresh install (I’ve triple- and even quadruple-checked the username and password given in the setup summary page), which is why I’m trying to reset the username/password through MySQL. It appears as if the username is saved as plain-text in the DB, so I think a password change is what is necessary. If I can do that without changing the username, nothing like it, but I’m also open to changing both the admin username and password if required. :slight_smile:

UPDATE users_secure SET `password` = '$2a$05$MKtnxYsfFPlb2mOW7Qzq2Oz61S26s5E80Yd60lKdX4Wy3PBdEufNu' WHERE `username` = '<your username>'

Thanks for the query. The query was executed successfully, and the password has been seemingly changed to pass. But I’m still not able to login. By the way, I restarted Apache and MySQL after changing the password, in case OpenEMR caches the credentials from the DB, but no luck still. :frowning:

what do you see with

select * from users_secure;

@adunsulag and I identified a potential bug for someone with a similar issue on this forum last month or so ago.
I that case it appeared the globals table was corrupted from a previous save where password worked however, app can’t start.
Check or Restore globals table from a backup or install the table a new from database sql. Just the globals table mind you.

Another issue after changing password ensure the password length global(in globals table) is not set to above 4 characters.

1 Like

Can also check the log table to see why the login failed (it gives specific reasons, for example, if access controls not being set up correctly). If can login with another use, can use the log viewer. Or, if not, can look at it directly from database (comments field).

Or, if not, can look at it directly from database (comments field).

Hi, I couldn’t find a comments field in users_secure. Is this field present in another table, perhaps?

In the meantime, I’ve found a table called logs, and it also has a comments field. So I’ve attached the table here in PDF format. Are these the right log entries?

sql.pdf (93.2 KB)

How do I restore/re-install the globals table? Would you please walk me through the process?

I did go through the global table, and I found a record gbl_minimum_password_length with the value 9. Shall I set it to 4 and see if it solves the problem?

Showing rows 0 - 0 (1 total, Query took 0.0007 seconds.)

SELECT * FROM `users_secure` WHERE 1;

1	emr-administrator	$2a$05$MKtnxYsfFPlb2mOW7Qzq2Oz61S26s5E80Yd60lKdX4W...	2021-12-01 13:34:54	2021-12-12 07:19:23	

I think I should also mention this, just in case. The Login screen shows the red box saying “Invalid username or password” right when the page loads, before I even have a chance to enter anything. :slight_smile:

Copy/paste the comments field from the last row in above log table pdf into a base64 decoder to see what it is saying: https://www.base64decode.org/

Thanks for the help, Brady. This is the message I get, when I convert the comment of the latest record:

failure: ::1. user not in any phpGACL groups

hi @magnetar47 , try the solution here: Can't login with initial user - #9 by brady.miller

I executed this query, restarted Apache, and tried logging in, but no luck still. FYI, the query executed successfully, and here’s the table after inserting the new record:

gacl_groups_aro_map.csv (32 Bytes)

Here’s the comment from the latest log entry corresponding to today’s login attempt:

failure: ::1. user not in any phpGACL groups

It’s showing the same error message. I’ve double-checked that this is indeed from the log-entry corresponding to my login attempt after following @brady.miller’s suggestion.

Let me know if I should try something else. The ball is in your court now. :wink:

hi @magnetar47 , would reinstall since only that 1 entry in gacl_groups_aro_map could cause other issues down the road.

Alright, I’ll do that. Any idea as to why it didn’t install properly the first time? Should I especially watch out for something, when I reinstall OpenEMR?

By the way, do I just re-run setup.php to reinstall OpenEMR again, or is there some uninstallation process to do before that?

Disregard my comment. I was looking at the demo install with additional users and groups.

Just need to add an entry to gacl_aro as well I believe.

INSERT INTO `gacl_aro`(`id`, `section_value`, `value`, `order_value`, `name`, `hidden`) VALUES ('10','users','admin','10','Adminstrator','0')

Right. Good thing I checked back before starting the uninstallation, haha.

So that query executed successfully, but now when I go to localhost/openemr, I’m faced with this error message:

Warning: mysqli_real_connect(): (HY000/1044): Access denied for user 'openemr'@'localhost' to database 'openemr' in D:\xampp\htdocs\openemr\library\ADODB_mysqli_log.php on line 191

Fatal error: Uncaught TypeError: mysqli_query(): Argument #1 ($mysql) must be of type mysqli, bool given in D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\drivers\adodb-mysqli.inc.php:788 Stack trace: #0 D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\drivers\adodb-mysqli.inc.php(788): mysqli_query(false, 'SET NAMES 'utf8...', 0) #1 D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\adodb.inc.php(1263): ADODB_mysqli->_query('SET NAMES 'utf8...', false) #2 D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\adodb.inc.php(1241): ADOConnection->_Execute('SET NAMES 'utf8...', false) #3 D:\xampp\htdocs\openemr\library\ADODB_mysqli_log.php(60): ADOConnection->Execute('SET NAMES 'utf8...', false) #4 D:\xampp\htdocs\openemr\library\sql.inc(53): ADODB_mysqli_log->ExecuteNoLog('SET NAMES 'utf8...') #5 D:\xampp\htdocs\openemr\interface\globals.php(268): require_once('D:\\xampp\\htdocs...') #6 D:\xampp\htdocs\openemr\interface\login\login.php(28): require_once('D:\\xampp\\htdocs...') #7 {main} thrown in D:\xampp\htdocs\openemr\vendor\adodb\adodb-php\drivers\adodb-mysqli.inc.php on line 788

I’m pretty sure I didn’t modify anything yesterday that could cause this, so I don’t understand what’s going on. I tried after restarting Apache, but no luck. Is this error related to this current topic, or should I open a new topic for this issue?