iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Use the least invasive recovery method that matches your access. If the administrator account has a working email address, start at Special:UserLogin and choose Email new password. If you administer the server, MediaWiki 1.40 and later normally use the changePassword maintenance script through maintenance/run.php. If the account is unusable or has lost its administrator groups, createAndPromote can create or repair an account. Direct database changes are a last resort because the password format and authentication provider matter.
This guide covers MediaWiki’s built-in recovery paths, version differences, exact commands, security precautions, and the failures most likely to block recovery.
Choose the recovery path first
Pick the method that requires the smallest amount of access and changes the fewest things. Resetting a password does not automatically restore administrator groups, and changing a local database password may have no effect when an external identity provider controls authentication.
| Method | Access required | What it does | Administrator groups | External authentication | Risk and reversibility |
|---|---|---|---|---|---|
| Email new password on Special:UserLogin | Username and a working account email | Sends a temporary password and instructions | Leaves groups unchanged | Usually not authoritative for LDAP, SSO, or similar providers | Lowest risk; no server changes |
| Special:PasswordReset | An account with editmyprivateinfo permission, plus a deliverable email |
Sends an automatically generated password | Leaves groups unchanged | Depends on the provider | Low risk; the route may be disabled |
| Special:ChangePassword | Already logged in | Changes the current account’s password directly | Leaves groups unchanged | Only works when the local provider accepts the change | Low risk; not a logged-out recovery method |
changePassword maintenance script |
Command-line or SSH access to the correct MediaWiki installation | Sets a password directly for a named user or numeric user ID | Leaves groups unchanged | May be ineffective with an external provider | Low database risk, but protect shell history and credentials |
createAndPromote |
Command-line or SSH access | Creates or modifies a user, sets a password, and grants selected groups | Can add sysop, bureaucrat, and other available groups |
May not override an external provider | More powerful; verify the account and groups carefully |
| Database modification | Database administration access and a verified backup | Changes the stored password value directly | Does not grant groups unless you change other records | Can fail or be irrelevant with LDAP, SSO, or another external provider | Highest risk; use only as a documented last resort |
Check the installation before changing anything
- Identify the version. Open Special:Version if the wiki is reachable. MediaWiki 1.40 and later normally invoke maintenance scripts through
php maintenance/run.php; older documentation may show direct execution of an individual script. - Confirm the installation path. Make sure the directory contains the wiki you intend to repair and that its
LocalSettings.phppoints to the expected database. A successful command against a different checkout can make the problem appear unchanged. - Determine who owns authentication. LDAP, SSO, OAuth, and other authentication extensions can make the local MediaWiki password non-authoritative. Recover the identity through that provider instead of editing the local password.
- Protect the recovery window. Restrict public access if practical, use an encrypted administrator connection, and do not paste a permanent password into a ticket, chat room, or shell command visible to other users.
- Plan the cleanup. If another operator supplies a temporary password, replace it immediately after login and remove or rotate any shared copy.
Reset by email
Use “Email new password” from Special:UserLogin
- Open the wiki’s login page, Special:UserLogin.
- Enter the administrator’s exact username. Usernames can differ by capitalization and spacing, so do not assume that a remembered display name is the login name.
- Choose Email new password rather than attempting repeated guesses.
- Open the message sent to the account’s registered address and follow its instructions. MediaWiki supplies a temporary password; it does not change administrator groups.
- Sign in with the temporary password, then set a unique permanent password through Special:ChangePassword.
This route depends on a valid email address and working outbound mail configuration. Check spam filtering, mail-server logs, and the account address if no message arrives. Repeated requests can also make it difficult to identify which temporary password is current, so wait for the newest message and use that one.
#1 Best Overall
Use Special:PasswordReset when it is available
Special:PasswordReset is a different workflow. It sends an automatically generated password by email and is available to accounts with the editmyprivateinfo permission. An administrator can disable the route with $wgPasswordResetRoutes; when it has been disabled, the missing page is a configuration decision rather than a browser problem.
PasswordReset is not the same as the authenticated Special:ChangePassword page. ChangePassword requires an existing login and changes a password directly. PasswordReset is intended to deliver a generated password to the account’s email address. Neither page restores sysop or bureaucrat membership.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Reset from a server shell with changePassword
When email is unavailable but you administer the server, the maintenance script avoids manually constructing a password hash. MediaWiki’s documentation describes the change-password maintenance script as a way for system administrators to change an account password.
MediaWiki 1.40 and later
Run the command from the wiki installation directory:
Rank #2
cd /path/to/mediawiki
php maintenance/run.php changePassword --user=Admin --password='Use-a-long-random-temporary-password'
Replace /path/to/mediawiki and Admin with the installation and exact account name. Quote a password containing spaces or shell metacharacters. The command sets the password but does not add or remove groups.
Use a numeric user ID when names are uncertain
The script accepts --userid as well as --user. A numeric ID is useful when two environments have similar names or when the username contains characters that are awkward to quote. Confirm the ID in the intended wiki before running a change.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →php maintenance/run.php changePassword --userid=123 --password='Use-a-long-random-temporary-password'
Avoid putting the password in shell history
The --password form can expose the secret in shell history, process listings, transcripts, or monitoring. The script also supports --passwordstdin. Feed the value from a protected prompt or secret-management mechanism instead of writing it literally in the command:
php maintenance/run.php changePassword --user=Admin --passwordstdin
Use the input method approved for your operating system and terminal, and ensure the secret is not logged by the wrapper that supplies standard input. After access is restored, replace any temporary credential that another operator could have seen.
Older installations and the maintenance directory
Older instructions may show the script being run from the maintenance directory:
cd /path/to/mediawiki/maintenance
php run.php changePassword --user=example --password=newpassword
That layout reflects the same indirect run.php mechanism used by current releases. Check the installed version before copying an older command, and do not mix files from one MediaWiki release with a different database or checkout.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallVerify the result
- Check the command’s exit status and any error text before assuming success.
- Open the normal login page in a private browser window and authenticate with the account.
- If the login succeeds but administrative tools are missing, the password was changed but the account’s groups were not; use the group-recovery procedure below.
- Change the temporary password again through the web interface if it was exposed to another person or stored in a command history.
Restore or create an administrator with createAndPromote
Use createAndPromote when the original account cannot be used, when its administrator groups were removed, or when you need a controlled emergency account. The script can create a user or modify an existing one, set a password, and assign groups that exist in the installation.
Create a new emergency administrator
cd /path/to/mediawiki
php maintenance/run.php createAndPromote Admin 'NEW_PASSWORD' --sysop --bureaucrat
This example requests both the sysop and bureaucrat groups. Use only the groups your recovery plan requires. Some installations define additional groups, such as interface-admin or bot; those flags work only when the group exists and your version supports it.
Rank #4
Modify an existing account
If the named account already exists, add --force when you intentionally want to change its password or grant the requested rights:
php maintenance/run.php createAndPromote Admin 'NEW_PASSWORD' --sysop --bureaucrat --force
Check the spelling and capitalization before using --force. Granting a powerful group to the wrong account can create a second security incident. Log in, inspect the account’s rights, and remove the emergency account or excess groups after the original administration path is repaired.
Recommended Free Tools
When this does not solve authentication
Creating a local user does not bypass an identity provider that supplies the login identity. If the wiki uses LDAP, SSO, or another external system, create or promote the account in that system according to its policy, then confirm that MediaWiki maps the external identity to the expected local groups.
Direct database changes: last resort only
The official password-reset guidance documents a direct update of user.user_password only as a last resort. Do not improvise a hash or copy a value from an unrelated MediaWiki version. The stored format depends on $wgPasswordDefault, and MediaWiki can convert a recognized older format when the user next logs in.
Best Value
Conditions that must be true
- You have a complete database backup and have verified that it can be restored.
- You have identified the exact wiki database and user row through the intended
LocalSettings.php. - The wiki uses MediaWiki’s default authentication provider and password configuration, rather than an extension that delegates authentication elsewhere.
- You can schedule a controlled maintenance window and test the result without exposing the database publicly.
Why a database edit often fails
LDAPAuth and comparable extensions can ignore the local user_password value. A syntactically valid database update can therefore leave the user unable to log in, while also making later troubleshooting harder. Database access also carries backup, locking, replication, and rollback risks that the maintenance script avoids.
Safer recovery sequence
- Take and verify the database backup before changing any row.
- Confirm the authentication provider and the value of
$wgPasswordDefault. - Follow the exact password-format procedure for that MediaWiki release from the official password-reset documentation; do not substitute a guessed hash.
- Test the login in a restricted session and watch the application’s authentication logs.
- If the update fails, restore the backup or undo the documented change before attempting another method.
Because the correct stored representation varies with configuration, a database administrator who cannot verify those details should stop and obtain help from the site’s MediaWiki administrator rather than guessing.
Troubleshoot common recovery failures
| Symptom | Likely cause | Action |
|---|---|---|
| No “Email new password” option | The account has no usable email, mail delivery is not configured, or the login workflow is customized. | Verify the account address and outbound mail logs. If you control the server, use changePassword instead. |
| PasswordReset page is missing or denied | The route is disabled through $wgPasswordResetRoutes, or the requesting account lacks editmyprivateinfo. |
Use the permitted email route, ask a qualified administrator, or use the shell method. |
| Maintenance command says the user does not exist | The username is misspelled, capitalization differs, or the command targets another installation. | Check the exact account name, use --userid when appropriate, and recheck LocalSettings.php and the working directory. |
| PHP reports an unknown script or option | The command was copied from a different MediaWiki release, or the wrong PHP binary or checkout is being used. | Confirm the version in Special:Version, run the script through the release’s run.php, and verify the installation path. |
| Login works but the admin toolbar or pages are gone | The password changed, but the account no longer has sysop or another required group. |
Use createAndPromote with the intended groups, or have an existing bureaucrat restore them. |
| New local password is ignored | LDAP, SSO, or another authentication extension is authoritative. | Recover the identity in that provider and check its MediaWiki group mapping. |
| The account called WikiSysop cannot be found | The remembered name may not be the actual account, or that installer-created account may not exist in this database. | Confirm the username in the correct wiki before running a reset; do not create a replacement with broad rights until you have checked the intended installation. |
Secure the wiki after recovery
- Log in through the normal web interface and replace every temporary or shared password.
- Confirm the account’s groups and remove any emergency rights that are no longer needed.
- Review the account email address and recovery settings so the next reset can use a controlled mailbox.
- Delete temporary shell history, transcripts, secret files, and chat messages that contain the password.
- Rotate credentials for any operator, deployment account, or secret store that was exposed during recovery.
- Restore normal public access only after confirming that the login, administrative pages, and mail workflow behave as expected.
- Record the MediaWiki version, authentication provider, backup location, and approved recovery command in a restricted operations document.
Which method should you use?
Choose email when the account mailbox works. Choose the maintenance script when you have shell access and need only a password change. Choose createAndPromote when the account or its administrator groups must be created or repaired. Reserve a direct database update for a verified backup-and-rollback situation on a default-authentication installation. At every stage, confirm that you are operating on the intended MediaWiki release and database, because a technically successful reset on the wrong installation is still a failed recovery.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

