In the event you cannot log into MediaWiki due to username or password failure, you can change passwords and/or find the username when the username is lost. This section of the Getting started with MediaWiki course will explain changing passwords, resetting the password, and finding the username.
How do I change my password?
When the password is reset with the “Forgotten your login details?” link, the password is changed to a generated password. The generated passwords can be difficult to remember as they are random characters. To change the password to a more memorable password, you can change it in the preferences of the MediaWiki preferences page. These are the steps for changing the password in the MediaWiki user preferences.
- Log into MediaWiki
Click Preferences at the top left hand side of the site.
On the preferences page, Click Change Password in the Basic Information section of the Preferences page..
Type your old password and your new password twice.
Click Change Password.
What if I forgot my password?
In the case you forget your MediaWiki password, you can use the forgot password link to reset your password and email your login details. The following will explain how to reset your password an the MediaWiki Log in page.
Reset the password with the forgot password link
- Navigate to the MediaWiki login page
Click Log in at the top right of your MediaWiki site..
On the Log in / create account page, click Forgotten your login details.
The Reset password special page will prompt for you to enter your username.
Enter the username and click E-mail new password.
If the username was found the Reset password will display, A reminder e-mail has been sent.
If the username is invalid, the Reset password page will display,
There is no user by the name of “user”. Usernames are case sensitive. Check your spelling or create a new account.
If this occurs, you will need to obtain your username from PhpMyAdmin.
Next, check your email. The MediaWiki site will email you a new password. The email should look like the snapshot to the right.
Now you will be able to log in with the new password. After you log in you can reset the Password in the MediaWiki Preferences.
When MediaWiki is installed as a Binary database character set, The password cannot be changed through PhpMyAdmin. If the email address is not valid for whatever reason in your user preferences, the Forgotten your login details? link will fail to email your new password. In order to change the password, a bash script can be ran to update the password. The following steps will explain how to change the password through shell.
Changing or resetting the Password through shell
- SSH into your server.
Note! Not all servers have SSH access. On InMotion Hosting servers, only VPS (Virtual Private Server) or Dedicated servers have this available. If you need to change the password through shell on a shared server, contact support.
Navigate to your MediaWiki maintenance directory. For example:
Run the following bash command (Supplement the admin with your username and the pass1234 with the password you want to change to).
php changePassword.php –user=admin –password=pass1234
What if I forgot my username?
When the Forgotten your login details? link on the Log in / create account page fails to find your username, The username can be retrieved by logging into PhpMyAdmin and locating the username in the database. The following section will explain how to recover your MediaWiki username from your database through PhpMyAdmin.
- Log into cPanel.
- Navigate to Databases > PhpMyAdmin.
Select the database for the MediWiki site.
Find the users table.
Note!The Prefix will vary depending on the installation. Prefixes can look like mw_ or wiki_ depending if it was changed during installation.
Find the username in the user_name column of the table row.
Thoughts on “Managing passwords and usernames in MediaWiki”
Thanks, Tim, for correcting the shell method.
It would be good if the document were updated with Tim’s correction rather than two years later still having an error in
Thank you for bringing this to our attention. I have updated the article as per you and Tim’s suggestion. Let us know if you see any additional issues.
so i just discovered that in step 2 of
Changing or resetting the Password through shell
the command says
php changePassword.php –user-admin –password=pass1234
between user and admin is a – and should be =
im crazy new to this and could not get the email to work in my wiki so im thinking ill just have to do things manually. i attempted the shell option and recived this error
# php changePassword.php –user-test2 –password=apple
A “user” or “userid” must be set to change the password for
what does this mean?
i really appreciate any help
It looks like it does not recognize the user for which the password change was submitted.
i NEED A NEW PASSWORD FOR MY WIKI PRODUCTS IM BUYING
Can you elaborate on what you are trying to do?