{"id":277,"date":"2016-02-25T16:40:33","date_gmt":"2016-02-25T21:40:33","guid":{"rendered":"http:\/\/underhost.com\/blog\/?p=277"},"modified":"2025-03-09T15:30:07","modified_gmt":"2025-03-09T19:30:07","slug":"how-to-reset-wordpress-admin-password-via-ssh","status":"publish","type":"post","link":"https:\/\/underhost.com\/blog\/how-to-reset-wordpress-admin-password-via-ssh\/","title":{"rendered":"How to Reset a WordPress Admin Password via Command Line in cPanel"},"content":{"rendered":"\r\n<p>Forgot your WordPress admin password? If you have SSH or terminal access to your cPanel server, you can quickly reset it using the MySQL command line. Follow these steps to regain access to your WordPress dashboard.<\/p>\r\n\r\n\r\n<h2>Step 1: Find the WordPress Database Name<\/h2>\r\n<p>First, locate the database used by WordPress for your domain:<\/p>\r\n<ul>\r\n<li>Navigate to your website\u2019s root directory.<\/li>\r\n<li>Open the <code>wp-config.php<\/code> file.<\/li>\r\n<li>Look for the following line:<\/li>\r\n<\/ul>\r\n\r\n<blockquote>\r\n<pre><code>define('DB_NAME', 'your_database_name');<\/code><\/pre>\r\n<\/blockquote>\r\n\r\n<p>Take note of the database name, as you\u2019ll need it in the next step.<\/p>\r\n\r\n<h2>Step 2: Access the MySQL Database<\/h2>\r\n<p>Log into MySQL from the command line:<\/p>\r\n\r\n<blockquote>\r\n<pre><code>mysql<\/code><\/pre>\r\n<\/blockquote>\r\n\r\n<p>Once inside MySQL, select the WordPress database:<\/p>\r\n\r\n<blockquote>\r\n<pre><code>mysql> USE your_database_name;<\/code><\/pre>\r\n<\/blockquote>\r\n\r\n<h2>Step 3: View WordPress Users<\/h2>\r\n<p>To see a list of users and their hashed passwords, run:<\/p>\r\n\r\n<blockquote>\r\n<pre><code>mysql> SELECT ID, user_login, user_pass FROM wp_users;<\/code><\/pre>\r\n<\/blockquote>\r\n\r\n<p>This will display a table similar to the one below:<\/p>\r\n\r\n<pre>\r\n+----+------------+--------------------------------+\r\n| ID | user_login | user_pass                      |\r\n+----+------------+--------------------------------+\r\n|  1 | admin     | $P$B05GJOhuMCFlxtYsYjA8P\/sX0svNw81 |\r\n+----+------------+--------------------------------+\r\n<\/pre>\r\n\r\n<h2>Step 4: Reset the WordPress Admin Password<\/h2>\r\n<p>Update the password for the desired user:<\/p>\r\n\r\n<blockquote>\r\n<pre><code>mysql> UPDATE wp_users SET user_pass = '2886b319b37e797234026d279bafd745' WHERE ID = 1;<\/code><\/pre>\r\n<\/blockquote>\r\n\r\n<h2>Step 5: Verify the Password Update<\/h2>\r\n<p>Check if the update was successful:<\/p>\r\n\r\n<blockquote>\r\n<pre><code>mysql> SELECT ID, user_login, user_pass FROM wp_users WHERE ID = 1;<\/code><\/pre>\r\n<\/blockquote>\r\n\r\n<p>The output should display the new password hash.<\/p>\r\n\r\n<h2>Step 6: Generate an MD5-Encrypted Password<\/h2>\r\n<p>WordPress uses MD5 hashing for passwords. You can generate a new MD5 hash using an online tool:<\/p>\r\n<p><a href=\"http:\/\/www.md5hashgenerator.com\/\" target=\"_blank\"><strong>MD5 Hash Generator<\/strong><\/a><\/p>\r\n\r\n<h2>Alternative Method: Reset WordPress Password via Email<\/h2>\r\n<p>If you have email access, try resetting your password via:<\/p>\r\n<ul>\r\n<li>Go to <code>yourdomain.com\/wp-admin<\/code>.<\/li>\r\n<li>Click <strong>Lost your password?<\/strong>.<\/li>\r\n<li>Enter your admin email and follow the reset link.<\/li>\r\n<\/ul>\r\n\r\n<h2>Need Help?<\/h2>\r\n<p>If you&#8217;re unable to reset your password, UnderHost\u2019s support team is available 24\/7. Contact us at <a href=\"https:\/\/customerpanel.ca\/client\" target=\"_blank\">@CustomerPanel<\/a> for assistance.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Lost access to your WordPress admin account? Reset your password using MySQL commands in cPanel\u2019s command line.<\/p>\n","protected":false},"author":1,"featured_media":4628,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,11,47,37],"tags":[],"class_list":["post-277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-how-to","category-software","category-wordpress"],"_links":{"self":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":4,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"predecessor-version":[{"id":5129,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/277\/revisions\/5129"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media\/4628"}],"wp:attachment":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}