Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk12 min

How to Reset a MediaWiki Admin Password (Email, Shell, and Recovery Options)

Use email first, the changePassword maintenance script when you have shell access, and createAndPromote when an account or sysop rights must be restored. Database edits belong only at the end of the recovery process.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the administrator account still has a working email address, start at Special:UserLogin and select Email new password. If you administer the server, the safer non-database method is MediaWiki’s changePassword maintenance script. On MediaWiki 1.40 and later, run it through maintenance/run.php. If the account is unusable or has lost its administrator groups, createAndPromote can create or repair a privileged account. Edit the database only as a last resort, after a backup and only when the wiki uses MediaWiki’s local authentication.

Choose the recovery path that matches your access

Use the least invasive option that can actually reach the account. A web reset does not require server access, while a maintenance script requires command-line or SSH access to the MediaWiki installation. A database change carries the greatest recovery and integrity risk.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Method Access required What happens to the password Administrator groups External authentication Risk and reversibility
Email reset from Special:UserLogin Username and a working email address on the account MediaWiki emails a temporary password and instructions Groups are not changed May not control logins when LDAP, SSO, or another provider is authoritative Lowest impact; no server or database change
changePassword maintenance script Shell or SSH access to the wiki installation Sets a password directly for the selected local account Groups are not changed Local password may be ignored by an external provider Low database risk; protect the command and rotate the temporary password
createAndPromote maintenance script Shell or SSH access Creates or updates an account and sets its password Can add sysop, bureaucrat, and other supported groups May not help when an external provider owns authentication Powerful account and group change; verify the target wiki carefully
Direct user.user_password database change Database access and a verified backup Replaces the stored password value according to the configured format Groups are not changed Can be ineffective with extensions such as LDAPAuth Highest risk; use only as a last resort

Before any server-side command, confirm that you are in the intended MediaWiki installation and that its LocalSettings.php points to the intended database. A command run against the wrong checkout or database can change a different wiki than the one you are trying to recover.

Reset the password by email

Use “Email new password” from the login page

  1. Open the wiki’s Special:UserLogin page.
  2. Enter the administrator’s username.
  3. Select Email new password.
  4. Complete the request. MediaWiki sends a temporary password and instructions to the email address stored for that account.
  5. Sign in with the emailed credentials and change the password to a new, private value through the authenticated password-change page.

This is the preferred route when the mailbox works because it avoids shell access and does not alter group membership. It cannot help if the account has no usable email address, the mail system is broken, or the account is authenticated by an external identity provider.

Understand the separate PasswordReset page

Special:PasswordReset is not the same page as Special:ChangePassword. ChangePassword requires an authenticated session and changes that user’s password directly. PasswordReset sends an automatically generated password by email. The PasswordReset route is available to accounts with the editmyprivateinfo permission and can be disabled with $wgPasswordResetRoutes. If an administrator has disabled that route, the page will not be available even though the installation otherwise supports password recovery.

When the email never arrives

  • Verify that the username identifies the intended account and that the account’s recorded email address is still accessible.
  • Check the mailbox’s spam or quarantine folders and the wiki’s mail configuration.
  • Ask a server operator to use changePassword instead of repeatedly submitting web reset requests.
  • If the wiki uses LDAP, SSO, or another external authentication extension, recover the account through that provider; changing MediaWiki’s local password may have no effect.

Use the changePassword maintenance script

MediaWiki 1.40 and later

Since MediaWiki 1.40, maintenance scripts should normally be invoked indirectly through php ./maintenance/run.php. From the wiki’s installation directory, run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd /path/to/mediawiki
php maintenance/run.php changePassword --user=Admin --password='Use-a-long-random-temporary-password'

Replace /path/to/mediawiki with the actual installation path and replace Admin with the exact account name. The password shown is only an example; generate a long random temporary value and replace it immediately after access is restored.

Run the script safely

  1. Obtain shell or SSH access as an account that can run the wiki’s PHP maintenance commands.
  2. Change to the MediaWiki installation directory. The maintenance-script documentation places scripts in the maintenance directory.
  3. Confirm that the checkout and its LocalSettings.php belong to the production wiki you intend to recover.
  4. Use the current invocation, php maintenance/run.php, on MediaWiki 1.40 and later.
  5. Specify the account with --user=USERNAME, or use the numeric --userid=ID when the username is ambiguous or difficult to enter exactly.
  6. Set the temporary password, then sign in through the normal web interface.
  7. Change the temporary value to a new password known only to the account owner and remove it from operator notes, tickets, or shared chat.

Avoid putting the password in shell history

The script supports --passwordstdin. Pipe the password to the command instead of placing it in the command-line argument:

printf '%sn' 'Use-a-long-random-temporary-password' | php maintenance/run.php changePassword --user=Admin --passwordstdin

The exact options documented by the script are --user, --userid, --password, and --passwordstdin. Use the stdin form when shell history, process listings, or shared terminal logs could expose a password. The password still needs careful handling in the shell pipeline and should be rotated after login.

If you are already in the maintenance directory

The official password-reset example can also be expressed from that directory as:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
php run.php changePassword --user=example --password=newpassword

The important distinction is the MediaWiki version: older instructions may show direct execution of an individual script, while MediaWiki 1.40 and later expect the indirect run.php launcher.

What this script does not do

changePassword changes the selected account’s password. It does not grant sysop, bureaucrat, or other groups. If the password works but the account no longer has administrator tools, use the group-recovery procedure below.

Create or restore an administrator with createAndPromote

When to use it

Use this maintenance script when the original administrator account cannot be used, when no usable administrator remains, or when an existing account needs its administrator groups restored. The script can create a user or modify an existing one, set a password, and add groups.

MediaWiki 1.40 and later command

cd /path/to/mediawiki
php maintenance/run.php createAndPromote Admin 'NEW_PASSWORD' --sysop --bureaucrat

This example creates or updates Admin, sets the supplied password, and requests both the sysop and bureaucrat groups. Use the least privilege needed: a normal administrator recovery generally needs --sysop, while bureaucrat grants additional user-rights management authority.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Modify an account that already exists

If the named account already exists, add --force when you intend to change its password or grant the requested rights:

php maintenance/run.php createAndPromote Admin 'NEW_PASSWORD' --sysop --force

The script can also request --interface-admin, --bot, or custom groups when those groups exist on the installation. A custom group name is not created merely by typing it; the wiki must define that group and its rights.

Verify both identity and privileges

  1. Run the command only after confirming the installation path and database in LocalSettings.php.
  2. Use the exact account name you intend to create or modify.
  3. Sign in with the temporary password.
  4. Check that the account has the required group and that administrator-only actions are available.
  5. Change the temporary password immediately and document who received any emergency access.

Because createAndPromote can alter both credentials and groups, treat it as a controlled recovery operation rather than a routine password change.

Direct database modification: last resort only

MediaWiki’s official password-reset guidance documents changing user.user_password directly only as a last resort. Do not start here merely because shell access is inconvenient.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Conditions that must be true

  • Take and verify a database backup before changing anything.
  • Confirm that the wiki uses MediaWiki’s default authentication provider and password configuration.
  • Check the configured $wgPasswordDefault, because the stored password format depends on that setting.
  • Understand that an authentication extension such as LDAPAuth can make a local database password ineffective.
  • Restrict public access while the recovery is in progress if the wiki is exposed to untrusted users.

Why a plain-text replacement is unsafe

The user_password column stores a value in the format expected by the configured MediaWiki password system; it is not a field for an arbitrary plain-text password. A value in a recognized older format may be converted by MediaWiki at the next successful login. A value in the wrong format can prevent authentication altogether, which is why a backup and the supported maintenance script are safer.

After a database recovery, test the login, change the temporary credential through MediaWiki, and keep the backup until the account and the rest of the wiki have been verified. Do not edit group tables or grant rights as part of a password-only recovery unless you have separately established that the account also lost its permissions.

Check version and authentication configuration before troubleshooting

Identify the MediaWiki version

Check the installed version before choosing a command. MediaWiki 1.40 and later use maintenance/run.php; older documentation may show direct script execution. Applying an older command to a current installation, or a current command to an older layout without checking, is a common source of confusing errors.

Confirm the target installation

  • Inspect the intended installation directory, not a backup, staging checkout, or an abandoned release directory.
  • Read LocalSettings.php to confirm the database and configuration used by that wiki.
  • Ensure the PHP environment used by the shell is the one supported by the installed MediaWiki release.
  • Keep a record of the account name, command, time, and operator for later auditing, without recording the actual password.

Determine who controls authentication

With local MediaWiki authentication, changePassword and the web reset flow can change the credential MediaWiki checks. With LDAP, SSO, or another external provider, the provider may be authoritative. In that case, recover or reset the identity in the provider’s system and do not assume that editing MediaWiki’s local password will change the login result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot the common failure cases

The reset email is not working

Use the shell route if the mailbox is inaccessible or mail delivery is failing. If the account is externally authenticated, contact the identity provider instead. PasswordReset can also be unavailable when $wgPasswordResetRoutes disables it, and it requires the editmyprivateinfo permission.

The script reports that the user cannot be found

Recheck the spelling and capitalization of the username. If necessary, use the account’s numeric ID with --userid. Make sure the command is running against the production database identified by LocalSettings.php, not a different wiki.

The password changes but administrator tools are still missing

A password reset does not change group membership. Use createAndPromote with the appropriate group option and, for an existing account, --force. Then verify the account’s rights in the wiki before ending the recovery session.

The command appears to succeed but login still fails

Check for an external authentication provider first. LDAP, SSO, or another authentication extension may ignore the local password. Also verify that the command targeted the right installation and database, and that the account name was exact. Do not proceed to direct database editing until those checks are complete.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The database recovery made the account unusable

Stop making ad-hoc edits. Restore the verified backup or consult the administrator responsible for the configured password format. The correct stored format depends on $wgPasswordDefault, and a local edit may never work when an external provider controls authentication.

If you do not have shell access

A hosting customer or delegated wiki administrator may have web access but no command-line access. In that situation, ask the hosting provider or server administrator to run the supported maintenance script rather than requesting an improvised database edit. Provide the exact wiki hostname, installation path if known, account name, and a safe contact method, but never send a permanent password in an ordinary support ticket.

When evaluating managed MediaWiki hosting for future recoveries, confirm that the service supports the MediaWiki version you run, provides tested backups, offers an administrative shell or a documented recovery procedure, and can accommodate LDAP, SSO, or other authentication integrations if you use them. Geographic support and operational responsibilities should also be clear. A provider that cannot identify which database and checkout it operates may not be able to recover the intended account safely.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use a controlled recovery checklist

  1. Identify whether the account uses local MediaWiki authentication or an external provider.
  2. Try the email route if the account mailbox is available and the reset route is enabled.
  3. If email is unavailable, verify the MediaWiki version and the production installation path.
  4. Use changePassword for a password-only recovery, or createAndPromote when the account or groups must be restored.
  5. Use --passwordstdin when a command-line password could appear in history or process logs.
  6. Test login and administrator functions, then replace every temporary credential.
  7. Keep a verified backup before any database action and retain it until recovery is confirmed.

This sequence prevents a common mistake: escalating to a more destructive method before checking whether a lower-impact option is available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Secure the wiki after access is restored

  • Replace every temporary password that appeared in a command, terminal, ticket, script, or shared message.
  • Remove temporary shell files and revoke or rotate any emergency credentials shared with another operator.
  • Confirm that the recovered account has only the groups it needs.
  • Review recent account and configuration changes for unexpected activity.
  • Restore normal public access only after the credential and privilege checks pass.
  • Keep a tested backup and document the correct recovery path, including whether authentication is local or external.

The safest routine is to use email when it works, changePassword when you control the server, createAndPromote when rights or the account itself must be restored, and database editing only when the supported paths are unavailable and the authentication configuration is understood.

Frequently Asked Questions

How do I reset a forgotten WikiSysop password?

If the WikiSysop account has a working email address, use Special:UserLogin and choose Email new password. With shell access, run changePassword through maintenance/run.php and specify the exact username. If the account also lost its sysop group, use createAndPromote with –sysop and, for an existing account, –force.

How do I change a MediaWiki password from the command line?

From the MediaWiki installation directory on version 1.40 or later, run php maintenance/run.php changePassword --user=USERNAME --password='TEMPORARY_PASSWORD'. Use --userid=ID when a numeric identifier is safer, or pipe the value with --passwordstdin to reduce exposure in shell history.

Why is the MediaWiki password-reset email not arriving?

Check the account’s recorded address, spam or quarantine folders, and the wiki’s mail configuration. Confirm that the account is not controlled by LDAP, SSO, or another external provider. If the mailbox or mail system is unavailable, have a server operator use changePassword instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What is the difference between PasswordReset and ChangePassword?

ChangePassword requires an authenticated session and changes that user’s password directly. PasswordReset sends an automatically generated password by email. PasswordReset requires the editmyprivateinfo permission and can be disabled with $wgPasswordResetRoutes, so it may not appear on every installation.

Can changePassword restore the sysop group?

No. changePassword changes only the selected account’s password. It does not alter group membership. Use createAndPromote with the needed group option, such as –sysop, and add –force when modifying an account that already exists.

How do I promote a new MediaWiki user to sysop?

With shell access, run php maintenance/run.php createAndPromote Admin 'NEW_PASSWORD' --sysop on MediaWiki 1.40 or later. Add –bureaucrat only when that higher privilege is required. If the account already exists, include –force and verify the target installation first.

Will changing the local database password fix an LDAP or SSO login?

Usually not. An external authentication provider may be authoritative, meaning MediaWiki’s local user_password value is ignored. Recover the identity in LDAP, SSO, or the configured provider instead of assuming a local password edit will change the login result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is directly editing user.user_password safe?

It is a last resort. Back up and verify the database first, confirm local MediaWiki authentication, and check $wgPasswordDefault because the stored format depends on that setting. A plain-text or incorrectly formatted value can prevent login, and extensions such as LDAPAuth may make the edit ineffective.

The Bottom Line

Use Email new password when the account mailbox works. If you control the server, use php maintenance/run.php changePassword for a password-only reset and createAndPromote when the account or administrator groups must be restored. Verify the MediaWiki version, installation, database, and authentication provider first. Back up before any database edit, and rotate every temporary credential after recovery.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.