This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
computing:migratewp [2019/02/18 05:45] – created oemb1905 | computing:migratewp [2022/09/03 23:11] (current) – oemb1905 | ||
---|---|---|---|
Line 11: | Line 11: | ||
------------------------------------------- | ------------------------------------------- | ||
- | This tutorial is designed to step one through how to migrate a self-hosted Word Press site manually. First, authenticate as root on the //old host// and backup your entire database. | + | This tutorial is designed to step one through how to migrate a mysql database to another host. The tutorial is named migratewp, because I first did this on a WP instance. In my case, I have cron jobs that run mysqldump nightly as follows: |
sudo -i | sudo -i | ||
Line 29: | Line 29: | ||
--routines | --routines | ||
> mysqldump-all-databases.sql | > mysqldump-all-databases.sql | ||
+ | | ||
+ | But if you don't have that, then just make a backup of the database on the source host as follows: | ||
- | The spacing is optional and thanks to @jjscha for providing a great template to use. This can and should be used as a backup script. | + | mysqldump |
- | + | ||
- | mysql -u user -h localhost | + | |
| | ||
- | This will take some time. | + | Once that's done, send the '' |
+ | |||
+ | scp all_databases.sql root@targethost.com: | ||
+ | |||
+ | Now, ssh into the target host and import | ||
- | mysql -u user -p | + | mysql -u root -p < / |
- | > SHOW DATABASES; | + | |
- | > EXIT | + | |
- | Run this command on both machines, and the output should be identical. | + | After the database |
- | scp -r / | + | DROP DATABASE olddb; |
- | + | DROP USER ' | |
- | Put the files in the appropriate locations, obviously make sure you set up TLS again if needed and check file permissions for the directories, | + | |
- | --- //[[netcmnd@jonathanhaack.com|oemb1905]] | + | In cases of large databases, you might get an error that the shell lost connection to the database or that it vanished, etc. In that case, adjust your packet and timeout settings: |
- | + | ||
- | | + | nano / |
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | --- //[[jonathan@haacksnetworking.org|oemb1905]] |