Reset wordpress admin password via commandline

1. Find the wordpress db name from wp-config.php in the document root.

3. Taking DB backup (In case of any issues after the restoration, you can restore with the dump file)

mysqldump databasename > databasename.sql

4. Enter into MySQL prompt.

mysql -u root -p password

root@hostname# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2859662
Server version: 5.1.56-log MySQL Community Server (GPL)

mysql>

mysql> use databasename;

mysql> select * from wp_users;

mysql> update wp_users set user_pass=MD5(‘new_password_here’) where  user_login=”new_admin_username”;

mysql> quit

Login with the “new_admin_username” and “new_admin_username”
Thats it 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *