How to Change Wordpress Admin Password
To update the WordPress admin password directly in the MySQL database, follow these steps:
1. Access the MySQL Database
Log in to your server using SSH or access your database using a tool like phpMyAdmin.
Select the WordPress database (often named something like wordpress
, wp_database
, or similar).
2. Locate the Admin User
The admin user data is stored in the wp_users
table.
Use the following query to find the admin user by username (replace admin
with your actual admin username if different):
SELECT * FROM wp_users WHERE user_login = 'admin';
3. Update the Admin Password
WordPress uses a hashing function called md5
for password security.
To update the password, use the following SQL query (replace newpassword
with the desired password):
UPDATE wp_users SET user_pass = MD5('newpassword') WHERE user_login = 'admin';
Note: WordPress versions after 2.5+ use MD5
for backward compatibility in the database, but WordPress will rehash the password using the more secure wp_hash_password()
function when the user logs in.
4. Verify the Change
After running the query, log in to your WordPress site using the new password.