{"id":6134,"date":"2021-02-18T17:25:44","date_gmt":"2021-02-18T11:55:44","guid":{"rendered":"https:\/\/www.skynats.com\/?p=6134"},"modified":"2025-10-28T11:18:59","modified_gmt":"2025-10-28T05:48:59","slug":"resetting-the-wordpress-admin-password","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/resetting-the-wordpress-admin-password\/","title":{"rendered":"Resetting the WordPress admin password using Linux or Unix MySQL CLI"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes, the WordPress user forgets there login credentials especially the password. The WordPress user can change their password easily via the &#8220;Lost password&#8221;. You can also Reset WordPress admin password by creating the MD5 Hash.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On our&nbsp;<a href=\"https:\/\/www.skynats.com\/server-management\/\">server management<\/a> plans, our experts will help you to reset the WordPress admin password using the Linux or Unix MySQL CLI. You can check with our team at any time for&nbsp;emergency support.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-follow-the-steps-to-reset-the-wordpress-admin-password-wp-cli\"><strong>Follow the steps to reset the WordPress admin password wp cli.<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Recovering the password by using the MySQL CMD that takes lesser steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, you need to log in as root server by using the SSh command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -user@debian-10-ec2-server-ip<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Later, find the MySQL version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql --version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can use the latest stable version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/sbin\/mysqld Ver 8.0.23 for Linux on x86_64 (MySQL Community Server - GPL)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You will get the WordPress database name from the wp-config.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Grep DB\u00ad_NAME wp-config.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">define( &#8216;DB_NAME&#8217;, &#8216;examplewp&#8217; );<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run the MySQL client as<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Mysql \u2013u root \u2013p examplewp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enter password: &nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run \u201cshow tables command\u201d to display the table list. Try to note the table name that ends with _users.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+-----------------------+\n| Tables_in_examplewp  |\n+-----------------------+\n| wp_commentmeta        |\n| wp_comments           |\n| wp_links              |\n| wp_options            |\n| wp_postmeta           |\n| wp_posts              |\n| wp_term_relationships |\n| wp_term_taxonomy      |\n| wp_termmeta           |\n| wp_terms              |\n| wp_thesis_backups     |\n| wp_usermeta           |\n| wp_users              |\n+-----------------------+\n13 rows in set (0.00 sec)\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">From the WordPress get the list of user that has been stored and note the ID.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SELECT ID, user_login, user_pass, user_email FROM&nbsp;wp_users;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+----+------------+------------------------------------+-------------------------+\n| ID | user_login | user_pass                          | user_email              |\n+----+------------+------------------------------------+-------------------------+\n|  1 | vadmin     | $P$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy | webmaster@example.com |\n+----+------------+------------------------------------+-------------------------+\n1 row in set (0.00 sec)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By following the commands reset the WordPress user password. This will replace the existing password with the new one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE wp_users SET user_pass = MD5('my-new-password-here') WHERE ID = 1;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We can see a confirmation on the screen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Query OK, 1 row affected (0.00 sec)\nRows matched: 1  Changed: 1  Warnings: 0\n\nLater, exit from the MySQL session.\nMysql &gt; \\q\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Before resetting the password we need to install the wp-cli<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Installing the wp-cli<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before you start installing the WP-CLI, ensure that you will meet the minimum requirements. Then start downloading the wp-cli.phar file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PHP 5.6 or later<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress 3.7 or later<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unix, Linux, FreeBSD, Cygwin like environment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">check and verify whether the phar file is working.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php wp-cli.phar --info<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Try to executive and move the files to any suitable PATH.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x wp-cli.phar\nsudo mv wp-cli.phar \/usr\/local\/bin\/wp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once the installation is done, you can run the following commands wp&#8211;info it displays the screen as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ wp --info\nOS: Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1\/RELEASE_X86_64 x86_64\nShell: \/bin\/zsh\nPHP binary: \/usr\/local\/bin\/php\nPHP version: 7.0.22\nphp.ini used: \/etc\/local\/etc\/php\/7.0\/php.ini\nWP-CLI root dir: \/home\/wp-cli\/.wp-cli\/vendor\/wp-cli\/wp-cli\nWP-CLI vendor dir: \/home\/wp-cli\/.wp-cli\/vendor\nWP-CLI packages dir: \/home\/wp-cli\/.wp-cli\/packages\/\nWP-CLI global config: \/home\/wp-cli\/.wp-cli\/config.yml\nWP-CLI project config:\nWP-CLI version: 2.4.0\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Updating the WP-CLI&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If suppose the WP-CLI is owned by any other system user, for that you need to run the following commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo wp cli update<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Reset WordPress admin password with following commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>## Grab it ##\ncurl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar\n \n## Make sure it is working ##\nphp wp-cli.phar --info\n \n## Switch to your webserver user ##\nsu - wwwuser\n # OR #\nsudo -u wwwuser -i\nchmod +x wp-cli.phar\n \n## Get a list of users ##\n.\/wp-cli.phar --path=\/http\/public user list\n \n## Set up a new password for user ID number 1 ##\n.\/wp-cli.phar --path=\/http\/public user update 1 --user_pass=NEW_PASSWORD_HERE\n \n## Remove wp-cli if you are not going to use it again (optional) ##\nrm wp-cli.phar\n \n## Get back to our root shell ##\nexit\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Test it<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Try to login<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/your-domain-com\/wp-login.php\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/your-domain-com\/blog\/wp-login.php\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Conclusion&nbsp;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\\From this blog, you will get an apparent view regarding how to reset the WordPress administrator password via the <a href=\"https:\/\/www.mysql.com\/\" target=\"_blank\" rel=\"noopener\">MySQL<\/a> command prompt. Get assistance from expert team support.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Sometimes, the WordPress user forgets there login credentials especially the password. The WordPress user can change their password easily via the &#8220;Lost password&#8221;. You can also Reset WordPress admin password by creating the MD5 Hash. On our&nbsp;server management plans, our experts will help you to reset the WordPress admin password using the Linux or [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,239,257,68,258],"tags":[25,206,241,46,72,259],"class_list":["post-6134","post","type-post","status-publish","format-standard","hentry","category-blog","category-linux","category-mysql","category-server-management","category-unix","tag-cloud-management","tag-linus-server","tag-linux","tag-mysql-server","tag-server-management","tag-unix"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=6134"}],"version-history":[{"count":1,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6134\/revisions"}],"predecessor-version":[{"id":16384,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6134\/revisions\/16384"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=6134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=6134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=6134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}