I forgot my administrator password, but I can't change it.

@sjpadgett @stephenwaite
Is there is a way I can use file system to make a changes


Because I dont know how to do in way you showing

Or if its possible please let me know how to submit it in terminal on Linux Mint

I have a meeting until three Eastern so I may be able to help you then

1 Like

we can definitely generate a new hashed pwd and change the one in database?

Hi Robert,
I kind of let Nerik down. Anyway you could jump in and help him get a new password so he can finish his upgrade?
I’ll owe ya one. Thanks

fyi I’m looking into improving clinical notes but I have to be careful because of ONC

1 Like

Done deal… tomorrow (in a few hrs) will def do it.

Looking forward to the clinical notes improvement.

1 Like

Hi @ncavalier ,
pl try this code. I tried and it successfully reset the password of Administrator on my test forum.

create this file inside the openemr folder, name it reset_admin.php
in the linux terminal run
sudo php /var/www/html/openemr/reset_admin.php

or in the browser
http://localhost/openemr/reset_admin.php

<?php
// Load DB variables from legacy sqlconf.php
require_once __DIR__ . '/sites/default/sqlconf.php';

// Use legacy variables (older OpenEMR versions)
$mysqli = new mysqli($host, $login, $pass, $dbase);

// Check connection
if ($mysqli->connect_error) {
    die("❌ Connection failed: " . $mysqli->connect_error . "\n");
}

// Prepare new password
$username = 'Administrator';
$newPassword = 'admin123';
$hashed = password_hash($newPassword, PASSWORD_DEFAULT);

// Update password
$stmt = $mysqli->prepare("UPDATE users_secure SET password = ? WHERE username = ?");
$stmt->bind_param("ss", $hashed, $username);

if ($stmt->execute()) {
    echo "✅ Password for '$username' has been reset to '$newPassword'\n";
} else {
    echo "❌ Failed to update: " . $stmt->error . "\n";
}

$stmt->close();
$mysqli->close();
?>

this will reset the Administrator password to admin123

Pl pm me if you want me to reset it for you.
Regards
Robert

1 Like

I’ve tested okay but just beaware that the username actually exists.
I modified so you can pass in username for ease of use.
php reset_admin.php Administrator

Here is the file to dropin to openemr root.

reset_admin.php (872 Bytes)

Big thank you Robert

1 Like

You are most welcome @sjpadgett , waiting eagerly got a facelift on clinical notes ck editor. :slight_smile:

Dear @Robert_James and @sjpadgett
Thank you for your help. Sorry I didn’t had a chance to contact you for long time, because I was a way.
I did everything by your recommendations, and god confirmation that pass updated but still cant login

I used Login - Administrator and Pass- admin123

From the beginning before input login info, there is the message incorrect pass

Was Administrator your original username? You need to reset your last used admin username.

@sjpadgett My admin user name was nerik-admin-31 and its also not working

try admin for username otherwise good chance you exceeded login attempts. Forum has many threads on this issue.

admin is also not working
I’m actually tried many times with user and admin pass, not working

I meant to change password with tool, that’s why I changed to allow any username! Did you read my message and did you try with tool?
But now I suspect that you have tried so many times you have run out of allow number of try’s

Haven’t you given me access to your server in the past?

No its actually first time I have this problem

Check your php error log and report otherwise I believe your limits have been reached for password. You can fix by editing globals table for these values and set back to defaults or values showing here.
Otherwise you will need to get help because I can’t guide you on how to do the IT stuff.

1 Like

Our main system we using in office is v6.0.0, we using for many years and everything works fine, for many years there was newer any requirements to change password.
But we had anther office location, were we used V7.0.0, and we didn’t now that this version is required password update every six month. This office was closed 6 month ago, and we didn’t used this system.
And now we we need to archive all medical notes for this location, and we cant login because its past 6 months period without login.