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:
cd /home/userna5/public_html/mediawiki/maintenance
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.