KNOWNHOST WIKI

User Tools

Site Tools


cms:reset-wordpress-admin-via-mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cms:reset-wordpress-admin-via-mysql [2017/11/16 12:49]
Daniel P.
cms:reset-wordpress-admin-via-mysql [2020/06/10 13:49] (current)
Karson N.
Line 3: Line 3:
 {{howhard>4}} {{howhard>4}}
  
-If you forget the admin password to your WordPress site, you may need to reset it. Although normally resetting the password can be done from [[https://codex.wordpress.org/Resetting_Your_Password#To_Change_Your_Password|within WordPress]], that isn't much help if the reason you need it changed is because you do not know the old one. Here, we go over how to change the WordPress password using mysql directly, so that you can then log into the WordPress admin area to change the password normally. As always, you can [[support:how-do-i-submit-a-ticket|open a Support Ticket]] if you need any assistance. Here are the things you will need to get started:+If you forget the admin password to your WordPress site, you may need to reset it. Although normally resetting the password can be done from ((https://codex.wordpress.org/Resetting_Your_Password#To_Change_Your_Password))[[https://codex.wordpress.org/Resetting_Your_Password#To_Change_Your_Password|within WordPress]], that isn't much help if the reason you need it changed is because you do not know the old one. Here, we go over how to change the WordPress password using mysql directly, so that you can then log into the WordPress admin area to change the password normally. As always, you can [[support:how-do-i-submit-a-ticket|open a Support Ticket]] if you need any assistance. Here are the things you will need to get started:
  
   * SSH access to your server   * SSH access to your server
   * The exact name of the database for this specific WordPress installation.   * The exact name of the database for this specific WordPress installation.
  
-First, log into the server via [[https://www.knownhost.com/wiki/software/how-can-i-use-putty-software-to-ssh-to-my-cpanel-server|SSH]].+First, log into the server via [[software:how-can-i-use-putty-software-to-ssh-to-my-cpanel-server|SSH]].
  
 Next, we choose a temporary password. You can learn more about passwords in general [[security:misc:how-can-i-generate-a-secure-random-password|here]]. Since this one is only temporary, it is sufficient for our purposes to use 23 alphanumeric characters of both cases. We can generate one of these as follows. When you run it you should get different output. Do //**not**// use the example password shown in this article! Next, we choose a temporary password. You can learn more about passwords in general [[security:misc:how-can-i-generate-a-secure-random-password|here]]. Since this one is only temporary, it is sufficient for our purposes to use 23 alphanumeric characters of both cases. We can generate one of these as follows. When you run it you should get different output. Do //**not**// use the example password shown in this article!
  
 <code> <code>
-root@host [~]# head -c 23 /dev/urandom | base64 | tr -d '/+=' | cut -c1-23 +  root@host [~]# head -c 23 /dev/urandom | base64 | tr -d '/+=' | cut -c1-23 
-wAXMRV05x8iMaAoW5BsNewa+  wAXMRV05x8iMaAoW5BsNewa
 </code> </code>
  
Line 20: Line 20:
  
 <code> <code>
-root@host [~]# mysql +  root@host [~]# mysql 
-Welcome to the MySQL monitor.  Commands end with ; or \g. +  Welcome to the MySQL monitor.  Commands end with ; or \g. 
-Your MySQL connection id is 123007 +  Your MySQL connection id is 123007 
-Server version: 5.6.33 MySQL Community Server (GPL)+  Server version: 5.6.33 MySQL Community Server (GPL)
  
-Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.+  Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  
-Oracle is a registered trademark of Oracle Corporation and/or its +  Oracle is a registered trademark of Oracle Corporation and/or its 
-affiliates. Other names may be trademarks of their respective +  affiliates. Other names may be trademarks of their respective owners.
-owners.+
  
-Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.+  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  
-mysql> +  mysql> 
 </code> </code>
  
Line 39: Line 38:
  
 <code> <code>
-# mysql -u mysqluser -p+  # mysql -u mysqluser -p
 </code> </code>
  
Line 47: Line 46:
  
 <code> <code>
-mysql> show databases; +  mysql> show databases; 
-+-----------------------------------------------------------------+ +  +-----------------------------------------------------------------+ 
-| Database                                                        | +  | Database                                                        | 
-+-----------------------------------------------------------------+ +  +-----------------------------------------------------------------+ 
-| information_schema                                              | +  | information_schema                                              | 
-| cpuser_dbname                                                   | +  | cpuser_dbname                                                   | 
-| cphulkd                                                         | +  | cphulkd                                                         | 
-| eximstats                                                       | +  | eximstats                                                       | 
-| cpuser2_dbname                                                  | +  | cpuser2_dbname                                                  | 
-| leechprotect                                                    | +  | leechprotect                                                    | 
-| modsec                                                          | +  | modsec                                                          | 
-| mysql                                                           | +  | mysql                                                           | 
-| performance_schema                                              | +  | performance_schema                                              | 
-| roundcube                                                       | +  | roundcube                                                       | 
-| cpuser3_dbname                                                  | +  | cpuser3_dbname                                                  | 
-+-----------------------------------------------------------------+ +  +-----------------------------------------------------------------+ 
-11 rows in set (0.00 sec)+  11 rows in set (0.00 sec)
  
-mysql> +  mysql> 
 </code> </code>
  
Line 71: Line 70:
  
 <code> <code>
-mysql> use cpuser3_dbname; +  mysql> use cpuser3_dbname; 
-Database changed+  Database changed
 </code> </code>
  
Line 78: Line 77:
  
 <code> <code>
-mysql> show tables like '%users'; +  mysql> show tables like '%users'; 
-+-----------------------------------+ +  +-----------------------------------+ 
-| Tables_in_cpuser3_dbname (%users) | +  | Tables_in_cpuser3_dbname (%users) | 
-+-----------------------------------+ +  +-----------------------------------+ 
-| wp_users                          | +  | wp_users                          | 
-+-----------------------------------+ +  +-----------------------------------+ 
-1 row in set (0.00 sec)+  1 row in set (0.00 sec)
 </code> </code>
  
Line 90: Line 89:
  
 <code> <code>
-mysql> select ID,user_login,user_pass from wp_users; +  mysql> select ID,user_login,user_pass from wp_users; 
-+----+-------------------------+------------------------------------+ +  +----+-------------------------+------------------------------------+ 
-| ID | user_login              | user_pass                          | +  | ID | user_login              | user_pass                          | 
-+----+-------------------------+------------------------------------+ +  +----+-------------------------+------------------------------------+ 
-|  2 | someuser                | $P$BPy4uj0AQuInJXUAg95NbKmz7udQR6/+  |  2 | someuser                | $P$BPy4uj0AQuInJXUAg95NbKmz7udQR6/
-|  3 | test                    | $P$BiXazWPE.9wyLQ67aO.dfLZ0mFrnM81 | +  |  3 | test                    | $P$BiXazWPE.9wyLQ67aO.dfLZ0mFrnM81 | 
-+----+-------------------------+------------------------------------+ +  +----+-------------------------+------------------------------------+ 
-2 rows in set (0.00 sec)+  2 rows in set (0.00 sec)
 </code> </code>
  
Line 103: Line 102:
  
 <code> <code>
-mysql> update wp_users set user_pass = MD5('wAXMRV05x8iMaAoW5BsNewa') where ID = 3; +  mysql> update wp_users set user_pass = MD5('wAXMRV05x8iMaAoW5BsNewa') where ID = 3; 
-Query OK, 1 row affected (0.00 sec) +  Query OK, 1 row affected (0.00 sec) 
-Rows matched: 1  Changed: 1  Warnings: 0+  Rows matched: 1  Changed: 1  Warnings: 0
 </code> </code>
  
Line 117: Line 116:
  
 <code> <code>
-root@host [~]# head -c 50 /dev/urandom | base64 | tr -d '/+=' | cut -c1-50 +  root@host [~]# head -c 50 /dev/urandom | base64 | tr -d '/+=' | cut -c1-50 
-fD6E8bX2NGWcKOeqpVy63v4EXIHcDhqMZd903nnh04WtqaoMgk+  fD6E8bX2NGWcKOeqpVy63v4EXIHcDhqMZd903nnh04WtqaoMgk
 </code> </code>
  
Line 124: Line 123:
  
 <code> <code>
-root@host [~]# head -c 23 /dev/urandom | base64 | tr -d '/+=' | cut -c1-23 +  root@host [~]# head -c 23 /dev/urandom | base64 | tr -d '/+=' | cut -c1-23 
-i8elmaGIVPerj7SdyzyQUWU+  i8elmaGIVPerj7SdyzyQUWU
 </code> </code>
  
Line 131: Line 130:
  
 <code> <code>
-root@host [~]# for each in $(seq 23); do head -c 23 /dev/urandom | base64 | tr -d '/+=' | cut -c1-23; done +  root@host [~]# for each in $(seq 23); do head -c 23 /dev/urandom | base64 | tr -d '/+=' | cut -c1-23; done 
-BZ7ObDNVxLTYVZ9nMKgn5mF +  BZ7ObDNVxLTYVZ9nMKgn5mF 
-033vOQwm4RjuC7ICZMHiN2t +  033vOQwm4RjuC7ICZMHiN2t 
-LaY8Hu8vcgRGlZwFKxddRVv +  LaY8Hu8vcgRGlZwFKxddRVv 
-f8n6haYdsOM12CWhkdJe0JU +  f8n6haYdsOM12CWhkdJe0JU 
-1jrEkqs9YqIErIlv1M2QHDt +  1jrEkqs9YqIErIlv1M2QHDt 
-iJnyUChfUGowEkBMLJgxWXn +  iJnyUChfUGowEkBMLJgxWXn 
-IQDTRs7pEXxjK06x8XWI3aP +  IQDTRs7pEXxjK06x8XWI3aP 
-Al8UFBmTLlF0qAKEfRbK8aC +  Al8UFBmTLlF0qAKEfRbK8aC 
-j7s0VMxguvMqB7s4TSfXKp8 +  j7s0VMxguvMqB7s4TSfXKp8 
-7AiS6Q9g832l2IAgHAMLZSn +  7AiS6Q9g832l2IAgHAMLZSn 
-bvjSZBJSzK86pbHSwsjx6Y4 +  bvjSZBJSzK86pbHSwsjx6Y4 
-1RkSop5zgGGjeMMHlZ5fpZw +  1RkSop5zgGGjeMMHlZ5fpZw 
-4SDnWr7iStzIy2aZZS93NkY +  4SDnWr7iStzIy2aZZS93NkY 
-IYBz05ugzm2YnAUuAIUhipC +  IYBz05ugzm2YnAUuAIUhipC 
-kCLJmGxnToYgLW0FTjW6yIu +  kCLJmGxnToYgLW0FTjW6yIu 
-uxbXglSNqs7IieyOOWOaYxw +  uxbXglSNqs7IieyOOWOaYxw 
-OOldEpyEV1mzV5QtIlK9Lod +  OOldEpyEV1mzV5QtIlK9Lod 
-mfKH9aOsxh89tps870OSTCJ +  mfKH9aOsxh89tps870OSTCJ 
-z59C97dAabjS5XBYgLysOO4 +  z59C97dAabjS5XBYgLysOO4 
-Z6REJyA4PZSUUCCd9becZyq +  Z6REJyA4PZSUUCCd9becZyq 
-ApR357yDAkAL14D6N6tdq2J +  ApR357yDAkAL14D6N6tdq2J 
-7ZBb8q2kXAQyMfxZpycqf8w +  7ZBb8q2kXAQyMfxZpycqf8w 
-OveV0IZN6D0preuHZ2eWcLx+  OveV0IZN6D0preuHZ2eWcLx
 </code> </code>
  
cms/reset-wordpress-admin-via-mysql.1510858160.txt.gz · Last modified: 2017/11/16 12:49 by Daniel P.