This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
computing:migratewp [2019/08/17 19:58] – oemb1905 | computing:migratewp [2022/07/31 17:50] – 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. First, use mysqldump |
sudo -i | sudo -i | ||
Line 34: | Line 34: | ||
sudo scp mysqldump-all-databases.sql user@newhostorip.com: | sudo scp mysqldump-all-databases.sql user@newhostorip.com: | ||
| | ||
- | Before your import the mysqldump databases into the new database, you need to create what I call a " | + | Before your import the mysqldump databases into the new database, you need to create what I call a " |
- | CREATE DATABASE | + | CREATE DATABASE |
- | GRANT ALL ON newdatabase.* TO ' | + | CREATE USER tempuser@localhost IDENTIFIED BY ' |
+ | GRANT ALL PRIVILEGES | ||
FLUSH PRIVILEGES; | FLUSH PRIVILEGES; | ||
EXIT; | EXIT; | ||
- | | + | |
- | GRANT ALL PRIVILEGES ON *.* TO ' | + | Now that you have created a temporary database and database user with full privileges, it is time to import the backup. The second command is what I used on some temperamental instance. The first command below is simple enough and should work. I retain both just in case an instance talks back to me. |
- | Now, time to import that database | + | mysql -u tempuser -p temp < /path/to/ |
+ | mysql -u tempuser -h localhost -p --database=temp < / | ||
- | mysql -u newdatabaseuser -h localhost -p --database=newdatabase < / | + | Once it finishes, log into the mysql command mode and verify the original |
- | + | ||
- | This will take some time. | + | |
sudo mysql -u user -p | sudo mysql -u user -p | ||
Line 53: | Line 53: | ||
> EXIT | > EXIT | ||
- | If possibly, run this command on both machines, and the output should be identical. | + | After the database |
- | sudo scp -r / | + | DROP DATABASE temp; |
- | + | DROP USER ' | |
- | Put the files in the appropriate locations, restart the mysql service and reboot. | + | |
- | DROP DATABASE newdatabase; | + | That should be all there is to it! |
- | DROP USER ' | + | |
- | --- //[[netcmnd@jonathanhaack.com|oemb1905]] | + | --- //[[jonathan@haacksnetworking.org|oemb1905]] |
- | | + |