Monday, June 1, 2015

How to Reset a Wordpress Password

If you have forgotten your wordpress credentials, or possibly have had your wordpress install compromised; you may find yourself needing to change your admin username and/or password to regain access to your site.

Reset a User's password through MySQL
  • Log in to your wordpress database using MySQL's command line interface
  • Find the ID of the user's password you want to change
SELECT ID, user_login, user_pass FROM wp_users;
  • Change that user's password to a new one
UPDATE wp_users SET user_pass=MD5('newstrongpassword') WHERE ID = usersID;

Reset a User's Password through phpMyAdmin

If you have Plesk or cPanel, phpmyadmin should be included by default. Open it up for the domain and database that your wordpress site belongs on. If you don't remember the database name, look in your wp-config.php for a line similar to this:
define('DB_NAME', 'wordpress_blog');
In this example, "wordpress_blog" is the name of the database.
  • Once you're logged in to phpmyadmin, click on the wp_users table.
  • Make sure you are on the browse screen
  • Find the username you want to change the password for
  • Click edit on that username
  • Enter in your new password in the Value field of the user_pass line
  • Select "MD5" from the dropdown under the Functions column for the user_pass line
  • Click Go at the bottom of the screen, and then you should be able to log in with the new password

How to change the primary IP addres of a cPanel server



Log in to SSH, and do the following:

Edit /etc/sysconfig/network-scripts/ifcfg-eth0

Change the IPADDR and GATEWAY lines to match the new IP and Gateway for the new ip


Edit /etc/sysconfig/network
Change the GATEWAY line here if it does not exist in the ifcfg-* file.


Edit /etc/ips
Remove the new primary IP from this file if it is present
Add the old primary IP to this file with the format ::


Edit /var/cpanel/mainip
Replace the old primary IP with the new primary IP


Edit /etc/hosts
Replace the old primary IP with the new one if needed. The hostname's dns will need to be updated too


Restart the network service to make the new IP the primary
service network restart
Note: You're probably going to be disconnected at this point, and have to log in to ssh using the new primary ip.


Restart the ipaliases script to bring up the additional IP
service ipaliases restart


Run ifconfig and make sure all IPs show up correctly


Update the cpanel license to the new primary IP


Verify you can still log in to WHM and there is no license warning
Verify cPanel