- Create a dump of the mysql database being migrated (e.g. diglib) with
mysqldump
or wp-cli
$ cd path/to/wordpress-to-migrate
$ wp export ~/wordpress-`date +%Y-%m-%d`.sql
- Edit the file to replace the the table prefix with the prefix and id used in the WPMU instance. This is the regex in vim:
:%s/wp_old/wp_1/g
:x
- Make a backup of the WMPU instance with
wp-cli
or mysqldump
$ cd path/to/wordpress-multi-user
$ wp export ~/wordpress-mu-`date +%Y-%m-%d`.sql
- "Restore" the edited SQL file from your original dump to the WPMU database. There's only one database in this file (the one you just overwrote the prefixes for) so it should update just those tables.
$ mysql -u wpmu-user -p wpmu-password wpmu-database < edited-wordpress.sql
- Check if it worked. If it didn't, restore the
wordpress-mu*.sql
file.
$ mysql u wpmu-user -p wpmu-password wpmu-database < wordpress-mu*.sql