Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Wordpress database transfer

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Background:

Wordpress installation database specified incorrectly, resulting in data on the site are put into the mysql system library.

mysql> show tables from mysql;

+---------------------------+

| Tables_in_mysql |

+---------------------------+

| columns_priv |

| db |

| event |

| func |

| general_log |

| help_category |

| help_keyword |

| help_relation |

| help_topic |

| host |

| ndb_binlog_index |

| plugin |

| proc |

| procs_priv |

| servers |

| slow_log |

| tables_priv |

| time_zone |

| time_zone_leap_second |

| time_zone_name |

| time_zone_transition |

| time_zone_transition_type |

| user |

| wp_commentmeta |

| wp_comments |

| wp_links |

| wp_options |

| wp_postmeta |

| wp_posts |

| wp_term_relationships |

| wp_term_taxonomy |

| wp_termmeta |

| wp_terms |

| wp_usermeta |

| wp_users |

+---------------------------+

The mysql database itself is stored in the mysql library, so we want to put the website data back into the wordpress library.

Thinking:

First, backup the wordpress data in the mysql library to/back/mysql, and then restore the backup data to the wordpress library.

Operation:

Step 1: Write a backup script

[root@localhost mysql]# cat wp_backup.sh

for tname in ` mysql -uroot -p'dong' -e "use mysql;show tables like 'wp_%'"|grep -iv tables`

do

tname_all="$tname_all $tname"

done

#echo $tname_all

mysqldump -uroot -p'dong' mysql $tname_all >/backup/mysql/wp_all_back.sql

Step 2: After verifying the correctness of the script, execute the script

Step 3: Restore the backup data to the WordPress repository

Step 5: Verify Results

mysql> show tables from wordpress ;

+-----------------------+

| Tables_in_wordpress |

+-----------------------+

| wp_commentmeta |

| wp_comments |

| wp_links |

| wp_options |

| wp_postmeta |

| wp_posts |

| wp_term_relationships |

| wp_term_taxonomy |

| wp_termmeta |

| wp_terms |

| wp_usermeta |

| wp_users |

+-----------------------+

12 rows in set (0.00 sec)

Step 6: Modify the WordPress Connection Library

Finally, the website is running normally, and it is over.

For more blogs, please visit www.ayard.com.cn

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report