Mass Reset WordPress User Passwords

I wrote a simply Bash script to reset all WordPress user passwords, enjoy

Basically, all users from the database are retrieved and put in an array then a random password is generated on line 6, password is reset on line 7, retrieve the users email on line 9 then finally send the user an email with the new username and password on line 10. You also want to echo back the username and password that was set in case you need that for your records

Replace with the name of the database, also the script assumes you are connecting with a user that has its MySQL password in ~/.my.cnf so no user or password options are specified for MySQL, if you have to specify a user and password, change the lines with mysql to

Change to the MySQL user and to the MySQL user

Contact Us