Managing passwords and usernames in MediaWiki

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.

  1. Log into MediaWiki
  2. log-in-mediawiki-7-preferences

    Click Preferences at the top left hand side of the site.

     
  3. log-in-mediawiki-8-change

    On the preferences page, Click Change Password in the Basic Information section of the Preferences page..

     
  4. log-in-mediawiki-9-change-old

    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

  1. Navigate to the MediaWiki login page
  2. log-in-mediawiki-3-forgot

    Click Log in at the top right of your MediaWiki site..

     
  3. log-in-mediawiki-4-reset

    On the Log in / create account page, click Forgotten your login details.

  4. log-in-mediawiki-5-email-sent

    The Reset password special page will prompt for you to enter your username.

    Enter the username and click E-mail new password.

     
  5. log-in-mediawiki5a-reset-fail

    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.

     
  6. log-in-mediawiki-6-new-pass

    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

  1. 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.

  2. log-in-mediawiki-10-bash

    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.

  1. Log into cPanel.
  2. Navigate to Databases > PhpMyAdmin.
  3. log-in-mediawiki-11a-click-database

    Select the database for the MediWiki site.

  4. log-in-mediawiki-12-select-users-table

    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.

     
  5. log-in-mediawiki-13-find-username

    Find the username in the user_name column of the table row.

     

8 thoughts on “Managing passwords and usernames in MediaWiki

    1. It would be good if the document were updated with Tim’s correction rather than two years later still having an error in

      1. 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.

  1. hello again 

    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 =

  2. hello 

     

    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

Was this article helpful? Join the conversation!