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: