Cannot log in as admin in Ubuntu OpenEMR

Situation
I am using OpenEMR on a cloudhosted server (Ubuntu). I can log in as a secretary, but I cannot log in as the admin. It says username or password are invalid, but I can’t change it. I have very user-level knowledge, so I hope you can have patience with me. Thanks in advance.

OpenEMR Version
I’m using OpenEMR version 7.0.3 (4)

Browser:
I’m using Google Chrome.

Operating System
I’m using Windows 11.

hi @Yanara_Debora, guessing you’re going to need to get into the db and run a special command to reset the password expiration. See this post.

It seems like the same problem, but how do I go about accessing the database? Excuse my ignorance. :sweat_smile:

Hi @Yanara_Debora ,

I asked AI : “I am using OpenEMR on a cloudhosted server (Ubuntu). how do I go about accessing the database”

Here is what I got:
Accessing OpenEMR Database on Ubuntu Cloud Server

Step 1: SSH into Your Server

bash

ssh username@your-server-ip

Replace username with your actual username and your-server-ip with your server’s IP address.

Step 2: Locate Database Credentials

Once connected via SSH, find your database credentials in the OpenEMR configuration file:

bash

sudo cat /var/www/html/openemr/sites/default/sqlconf.php

This will show you:

  • $host - Database host (usually localhost)

  • $dbase - Database name (usually openemr)

  • $login - Database username

  • $pass - Database password

Step 3: Connect to the Database

Using the credentials from Step 2:

bash

mysql -u DATABASE_USERNAME -p DATABASE_NAME

For example, if your username is openemr and database is openemr:

bash

mysql -u openemr -p openemr

Enter the password when prompted (from the sqlconf.php file).

Step 4: Verify Connection

Once connected, you should see the MySQL prompt. Test with:

sql

SHOW TABLES;

This will list all tables in your OpenEMR database.

Alternative: Use Root Access

If the above doesn’t work, try connecting as root:

bash

sudo mysql -u root -p

Then switch to the OpenEMR database:

sql

USE openemr;
SHOW TABLES;

Note: Always backup your database before making any changes, and be cautious with direct database modifications as they can affect OpenEMR functionality.

I did it using the last date when it worked correctly for me.
I input
UPDATE users_secure set login_fail_counter = 0, last_update_password = “2026-02-13 12:53:00”, last_update = “2026-02-13 12:53:00” WHERE id = 1;
And got ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘12:53:00, last_update = 2026-02-13 12:53:00 WHERE id = 1’ at line 1

Hi @Yanara_Debora here is an Ai solution:
The issue is with the quotes you’re using for the datetime values. You’re using smart quotes (curly quotes) instead of straight quotes (standard ASCII quotes).

In your query, you have:

sql

last_update_password = “2026-02-13 12:53:00”

But MySQL expects:

sql

last_update_password = '2026-02-13 12:53:00'

The fix: Replace the curly quotes (“ ”) with straight single quotes (' '):

sql

UPDATE users_secure 
SET login_fail_counter = 0, 
    last_update_password = '2026-02-13 12:53:00', 
    last_update = '2026-02-13 12:53:00' 
WHERE id = 1;

This is a common issue when copying SQL from word processors, websites, or other applications that automatically convert straight quotes to typographic (curly) quotes. Hope this helps.

Exact same problem, still.

Can you share a screenshot?