1. CHANGE THE PASSWORD (USUALLY REQUIRED WHEN NEED TO CHANGE ADMIN PASS)
mysql> update wp_users set user_pass=MD5('newpass') where ID= 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Here newpass in the bracket is the password you need to set. See the detailed explanation with snippet below
Catch your wordpress database from configuration file, (wp-config.php). Verify it
Here wordpress is the database name from configuration. I have verified it is available in the server issuing below command
root@cpanel [~]# mysqlshow | grep wordpress
| wordpress
Switch to the database from Mysql prompt
root@cpanel [~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 47061
Server version: 5.1.73-cll MySQL Community Server (GPLv2)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use wordpress;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
--------------------
Lets watch the tables inside the wordpress database
mysql> show tables;
+-----------------------+
| Tables_in_wordpress |
+-----------------------+
| wp_commentmeta |
| wp_comments |
| wp_links |
| wp_options |
| wp_postmeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_terms |
| wp_usermeta |
| wp_users |
+-----------------------+
11 rows in set (0.00 sec)
Now we can describe the wp_user and see the content
mysql> describe wp_users;
+---------------------+---------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+-----+---------------------+----------------+
| ID | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| user_login | varchar(60) | NO | MUL | | |
| user_pass | varchar(64) | NO | | | |
| user_nicename | varchar(50) | NO | MUL | | |
| user_email | varchar(100) | NO | | | |
| user_url | varchar(100) | NO | | | |
| user_registered | datetime | NO | | 0000-00-00 00:00:00 | |
| user_activation_key | varchar(60) | NO | | | |
| user_status | int(11) | NO | | 0 | |
| display_name | varchar(250) | NO | | | |
+---------------------+---------------------+------+-----+---------------------+----------------+
10 rows in set (0.00 sec)
We need to change the password from user_pass, lets see the content inside the table wp_user by grepping
Above we can see the users and the password set in Hash Md5, now we can change the same using the top mentioned command,
mysql> update wp_users set user_pass=MD5('newpass') where ID= 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
========================================================================
2. SWITCHING TO DEFAULT THEME WHEN THERE IS THEME ISSUES
mysql> UPDATE wp_options SET option_value = 'default' WHERE option_name = 'template';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> UPDATE wp_options SET option_value = 'default' WHERE option_name = 'stylesheet';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> UPDATE wp_options SET option_value = 'default' WHERE option_name = 'current_theme';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> SELECT ID, user_login, user_pass FROM wp_users;
+----+------------+----------------------------------+
| ID | user_login | user_pass |
+----+------------+----------------------------------+
| 1 | wordpress | e6053eb8d35e02ae40beeeacef203c1a |
+----+------------+----------------------------------+
1 row in set (0.00 sec)
Above we can see the users and the password set in Hash Md5, now we can change the same using the top mentioned command,
mysql> update wp_users set user_pass=MD5('newpass') where ID= 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
========================================================================
2. SWITCHING TO DEFAULT THEME WHEN THERE IS THEME ISSUES
mysql> UPDATE wp_options SET option_value = 'default' WHERE option_name = 'template';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> UPDATE wp_options SET option_value = 'default' WHERE option_name = 'stylesheet';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> UPDATE wp_options SET option_value = 'default' WHERE option_name = 'current_theme';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
========================================================================
3. CHANGE THE WORDPRESS SITE AND HOME URL( especially required during domain name change)
3. CHANGE THE WORDPRESS SITE AND HOME URL( especially required during domain name change)
mysql> describe wp_options;
+--------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------------------+------+-----+---------+----------------+
| option_id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| option_name | varchar(64) | NO | UNI | | |
| option_value | longtext | NO | | NULL | |
| autoload | varchar(20) | NO | | yes | |
+--------------+---------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
mysql> select * from wp_options where option_name ='siteurl' or option_name= 'home';
+-----------+-------------+----------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+----------------------------+----------+
| 33 | home | http://avidlinuxreader.com | yes |
| 1 | siteurl | http://avidlinuxreader.com | yes |
+-----------+-------------+----------------------------+----------+
2 rows in set (0.00 sec)
We need to change this domain name and URL to new , issue the below commands
mysql> UPDATE wp_options SET option_value = replace(option_value, 'http://avidlinuxreader.com', 'http://linuxavid.blogspot.in') WHERE option_name = 'home' OR option_name = 'siteurl';
Now we can see the new site and home URL
mysql> select * from wp_options where option_name ='siteurl' or option_name= 'home'; +-----------+-------------+------------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+------------------------------+----------+
| 33 | home | http://linuxavid.blogspot.in | yes |
| 1 | siteurl | http://linuxavid.blogspot.in | yes |
+-----------+-------------+------------------------------+----------+
2 rows in set (0.00 sec)
mysql> UPDATE wp_posts SET guid = replace(guid, 'http://avidlinuxreader.com', 'http://linuxavid.blogspot.in');
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> UPDATE wp_posts SET post_content = replace(post_content, 'http://avidlinuxreader.com', 'http://linuxavid.blogspot.in');
Query OK, 1 row affected (0.00 sec)
Rows matched: 4 Changed: 1 Warnings: 0
mysql> UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://avidlinuxreader.com', 'http://linuxavid.blogspot.in');
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
To be continued
To be continued
Comments
Post a Comment