This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
computing:migratewp [2019/06/16 05:50] – 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, completely set up LAMP and TLS and DNS, etc., before you begin migration, and review [[https:// | + | 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 |
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: | ||
- | Use scp to get the file to the new host: | + | mysqldump -u root -p --all-databases > all_databases.sql |
| | ||
- | sudo scp mysqldump-all-databases.sql user@newhostorip.com: | + | Once that's done, send the '' |
+ | |||
+ | | ||
+ | |||
+ | Now, ssh into the target host and import the databases as follows: | ||
- | Now, time to import that database into the new host: | + | mysql -u root -p < / |
- | mysql -u user -h localhost -p < / | + | After the database is migrated, simply copy all the files from web root for the instance over to the new host. Ensure that permissions, |
- | + | ||
- | This will take some time. Once it finishes, log into the mysql command mode and verify the databases | + | |
- | sudo mysql -u user -p | + | DROP DATABASE olddb; |
- | > SHOW DATABASES; | + | DROP USER ' |
- | > EXIT | + | |
- | Run this command on both machines, and the output should be identical. Now, it is time to migrate the website //files// over to the new host: | + | 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: |
- | | + | |
- | + | | |
- | Put the files in the appropriate locations, and that should be it. Definitely reboot, and I have found it is helpful to restart the router, modem, and workstations on the network. | + | |
+ | < | ||
- | --- //[[netcmnd@jonathanhaack.com|oemb1905]] | + | --- //[[jonathan@haacksnetworking.org|oemb1905]] |
- | | + |