|MediaWiki file: changePassword.php|
|Source code:||master • 1.35.2 • 1.31.14|
changePassword.php can be used to change the password of a user on your wiki. Passwords must be at least 10 characters.
The following examples assume that they are called from the
/maintenance/ directory of the wiki code.
php changePassword.php --user=target_username --password=new_password
php changePassword.php --user=JohnSmith --password=Secret12
Usernames and passwords can have spaces, which will need to be protected from your shell (be it bash or
cmd.exe; see Troubleshooting, below):
php changePassword.php --user="Anna Graham" --password="fierce sea ceasefire"
To display a help message:
php changePassword.php --help
--user(the user's name)
--password(the user's new password)
--help(displays help message)
- If your MediaWiki installation uses a memory cache, such as APC, memcached or Redis, then the user object is cached. Thus after making SQL changes you must flush the cache before a user can log in with the new password.
- Windows has special challenges with parsing double-quoted strings, as when a username or password contains spaces in the second example above.
- There are no spaces between the parameter=value in the command line.
This will cause a cryptic error:
php changePassword.php --user = username --password = newpassword
Removing the spaces will fix the problem.