SIGN IN / UP
    opened image

    If you have a Linux Ubuntu or CentOS 7 server hosting your WordPress website, you can reset the WordPress admin password via the console. This is especially useful if you do not have access to phpMyAdmin or if you prefer using the command line interface. In this article, we will walk you through the steps to reset the WordPress admin password via the console in Linux Ubuntu or CentOS 7.

    Step 1: Access the Console

    The first step is to access the console of your Linux Ubuntu or CentOS 7 server. You can do this via SSH by using a terminal application such as PuTTY.

    Step 2: Access the MySQL Database

    Once you have accessed the console, you need to access the MySQL database that your WordPress website is using. To do this, enter the following command:

     

    mysql -u root -p

    This will prompt you to enter the MySQL root password. Enter the password and press Enter.

    Step 3: Select the WordPress Database

    After entering the MySQL root password, you need to select the WordPress database. To do this, enter the following command:

     

    show databases;

    use wordpress_database;

     

    Replace "wordpress_database" with the name of your WordPress database. In my case admin_kn_base.

     

    Step 4: Update the Admin Password

    Once you have selected the WordPress database, you need to update the admin password. To do this, enter the following command:

     

    UPDATE `wp_users` SET `user_pass` = MD5( 'new_password' ) WHERE `wp_users`.`user_login` = "admin";

    Replace "new_password" with the new password you want to set and "admin" with the username of the admin account.

    Step 5: Exit MySQL

    After updating the admin password, you need to exit MySQL. To do this, enter the following command:

     

    exit;

     

    Step 6: Test the New Password

    After resetting the admin password, log out of the console and try logging in to your WordPress dashboard using the new password. If you can successfully log in, you have successfully reset the password.

    Conclusion

    Resetting the WordPress admin password via the console in Linux Ubuntu or CentOS 7 is a quick and easy solution to regain access to your website. It is recommended to use a strong password and change it regularly to ensure the security of your website. Additionally, ensure that you keep your website and plugins updated to prevent vulnerabilities that may be exploited by hackers.