Skip to content

Instantly share code, notes, and snippets.

@elizoller
Last active June 14, 2017 13:55
Show Gist options
  • Save elizoller/08d145cbd57a9e5c5680562ce40434bf to your computer and use it in GitHub Desktop.
Save elizoller/08d145cbd57a9e5c5680562ce40434bf to your computer and use it in GitHub Desktop.
process for migrating toolkit sites
  1. SSH into server where site is currently (ie. ssh [email protected])
  2. CD into directory for install (ie. cd /mnt/wordpressdata/aproudpast)
  3. Cat config file to get info (ie. cat wp-config.php)
  4. Create mysqldump file (ie. msyqldump --user=aproudpast_usr --password aproudpast > /home/sysbeekerz/aproudpast.sql) where the user name is the one listed in the wp-config file, the database name is the one in the config file and the ending path is the location where you would like sql dump file to end up. Putting in the shared user home directory means you don't actually have to move it across servers.
  5. Open another tab and SSH into the new server (ie. ssh [email protected])
  6. Login to mysql (ie. mysql -u root -p)
  7. Create the database (ie. CREATE DATABASE aproudpast;) Note that it is important to keep the database name the same as it was on the previous server so you do not have to update the wp-config file
  8. Use the new database (ie. USE aproudpast;)
  9. Import the dump (ie. SOURCE /home/sysbeekerz/aproudpast.sql)
  10. Switch to mysql database (ie. USE mysql;)
  11. Create database user (with the same credentials as on the old server) (ie. CREATE USER 'aproudpast_usr'@'localhost' IDENTIFIED BY 'hereIsThePassword';)
  12. Switch back to the old server and log in to mysql (ie. mysql -u aproudpast_usr -p)
  13. Show the user privileges (ie. SHOW GRANTS FOR 'aproudpast_usr'@'localhost')
  14. Copy each line of the grants and paste it into the mysql command for the new server. Should be something like (GRANT USAGE ON *.* TO 'aproudpast_usr'@'localhost' IDENTIFIED BY PASSWORD '*082349JDSFJDF'; GRANT ALL PRIVILEGES ON `aproudpast`.* TO 'aproudpast_usr'@'localhost';)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment