{"id":493,"date":"2022-06-27T17:27:37","date_gmt":"2022-06-28T00:27:37","guid":{"rendered":"https:\/\/blog.iabsolute.com\/?p=493"},"modified":"2022-06-27T17:27:37","modified_gmt":"2022-06-28T00:27:37","slug":"how-to-reset-wordpress-admin-password-via-mysql-command-line","status":"publish","type":"post","link":"https:\/\/blog.iabsolute.com\/?p=493","title":{"rendered":"How to reset WordPress Admin Password via MySQL Command Line"},"content":{"rendered":"\n<p><strong>Step 1 : Generating MD5 hash for WordPress admin password<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Try to change the current password\u00a0<strong>admin123<\/strong>\u00a0to\u00a0<strong>wpadmin123<\/strong>.Create a file called\u00a0<code>wp.txt<\/code>, containing nothing but the new password.<\/li><li><code># vi wp.txt <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw1.png\" alt=\"wppw1\"\/><figcaption> <\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw2.png\" alt=\"wppw2\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>Run the below command to get the MD5 string.<\/li><li><code># tr -d \u2018\\r\\n\u2019 &lt; wp.txt | md5sum | tr -d '-' <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw3.png\" alt=\"wppw3\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>Now you will get the MD5 string of the new password\u00a0<strong>wpadmin123<\/strong>\u00a0that you have saved in the file\u00a0<code>wp.txt<\/code>.<\/li><li>Please save the MD5 string locally.<\/li><li>Run the below command to remove the file\u00a0<code>wp.txt<\/code>.<\/li><li><code># rm -rf wp.txt <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw4.png\" alt=\"wppw4\"\/><\/figure>\n\n\n\n<p><strong>Step 2 : Updating the admin password through MySQL using the newly generated MD5 hash string<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Log in to MySQL with the below command.<\/li><li><code># mysql -u root -p <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw5.png\" alt=\"wppw5\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>Enter your MySQL password.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw6.png\" alt=\"wppw6\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>Run the below commands to use the WordPress database and show the table name with\u00a0<code>wp_users<\/code>. Here we are using the below database and user for testing.<\/li><li><strong>WordPress DB<\/strong>: wordpress<\/li><li><strong>WordPress User<\/strong>: wp_user<\/li><li><code>> use wordpress; <\/code><\/li><li><code>> show tables; <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw7.png\" alt=\"wppw7\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>Run the below command to get an idea of what\u2019s going on inside.<\/li><li><code>> SELECT ID, user_login, user_pass FROM wp_users; <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw8.png\" alt=\"wppw8\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>From here you can see the MD5 string of the current password of the database WordPress.<\/li><li>Now you can reset the password of your WordPress admin with the below command.<\/li><li><code>> UPDATE wp_users SET user_pass=('8221bbe0c8e475a295b7533c047a68c7') WHERE user_login = 'admin'; <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw9.png\" alt=\"wppw9\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>Now check with the below command if the password has changed.<\/li><li><code>> SELECT ID, user_login, user_pass FROM wp_users; <\/code><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.layerstack.com\/img\/docs\/resources\/wppw10.png\" alt=\"wppw10\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li><\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Step 1 : Generating MD5 hash for WordPress admin password Try to change the current password\u00a0admin123\u00a0to\u00a0wpadmin123.Create a file called\u00a0wp.txt, containing nothing but the new password. # vi wp.txt Run the below command to get the MD5 string. # tr -d &hellip; <a href=\"https:\/\/blog.iabsolute.com\/?p=493\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-493","post","type-post","status-publish","format-standard","hentry","category-my-linux"],"_links":{"self":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=493"}],"version-history":[{"count":1,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":494,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/493\/revisions\/494"}],"wp:attachment":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}