User Tools

Site Tools


wiki:multisite_wordpress_migration

Multisite Wordpress migration

1. Select only certain tables (each site has its own table prefix e.g. wp_3_*):

mysql -p -N information_schema -e "select table_name from tables where table_schema = 'wordpress_multisite' and table_name like 'wp_3_%'" > tables.txt

Put all names on single line:

cat tables.txt | xargs > table_oneline.txt

Multisite WP has 2 tables where the user info is kept for each site. They need to be renamed and added to DB for each site. Add this to table_oneline.txt

rename table `wp_usermeta` to `wp_3_usermeta`;
rename table `wp_users` to `wp_3_users`;

Dump:

mysqldump -p wordpress_multisite `cat table_oneline.txt` > wpexport.sql

2. Import on new server with

mysql -u root -p wettshop < wpexport.sql

3. Replace old strings with new ones using the wp-cli tool

wp search-replace 'http://example.com' 'http://example.org' --allow-root
wp search-replace 'http://example.com/wp-content/uploads/sites/3/' 'http://example.org/wp-content/uploads/' --allow-root

4. To access the admin site, choose some user from DB and change their password

update wp_3_users set user_pass = MD5 ('KbGmM7cm7QuGras') where id = 1;

See this schema how the folders should look like]]

Tested on

See also

References

wiki/multisite_wordpress_migration.txt · Last modified: 2022/10/15 11:53 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki