Change a WordPress password with SSH
You can make changes to your database through SSH, which you can use to update your WordPress password.
Warning: You should always back up your site before making changes to the database.
- You should always backup your site before performing any changes.
- Connect to your server or shared hosting account with SSH
Connect to MySQL using the following command:
mysql -u username -h host database -P port -p
Enter the database information from your database as follows:
- username is your database username
- host is your database hostname or IP address
- database is the database name
- port is the port MySQL is running on (by default this is 3306)
- When prompted, enter the password for that MySQL user.
- Enter the following MySQL command to switch to your WordPress database:
mysql> use database
- database is the database name
- Enter the following command to see a list of the tables in the database. Make notes of the table containing "_users".
mysql> show tables;
- Enter the following command to see the contents of your "users" table. Make note of the number in the "ID" column for the user you want to update.
mysql> SELECT * FROM table;
- table is the name of your users table.
- Use the following command to set your new password.
mysql> UPDATE table SET user_pass = MD5('password') WHERE ID = id;
- table is the name of the users table.
- password is your new password
- id is the number you located in Step 7
You can now login with your new password
More Info
- Return to Unable to sign in to WordPress.
- For more information about our premium support for WordPress, please visit our WordPress Premium Support Catalog.