Cross-database migration of wordpress databases and cross-database migration of wordpress Databases

Source: Internet
Author: User
Tags localhost mysql wordpress database

Cross-database migration of wordpress databases and cross-database migration of wordpress Databases

Background:

When Wordpress is installed, the database is incorrectly specified, causing data on the website to be stored in 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 data is stored in the mysql database, so we hope to re-store the website data to the wordpress database.

 

Ideas:

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

 

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: run the script after verifying the correctness of the script

Step 3: Restore the backup data to the wordpress Library

Step 5: Verify the result

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 library connected to wordpress

The website also runs normally and ends.

 

My blog will be published in these two places in the future:

1. Blog Park: http://www.cnblogs.com/ayard/

2. ayard: http://www.ayard.com.cn

I am also a beginner. please correct me if anything is wrong.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.