Tuesday, March 12, 2013

Moving a Drupal 7 site to a new host at TheLinuxFix.com

The Linux Fix

 I am migrating some sites over to a new host for a client. I highly recommend The Linux Fix. Those guys know what they are doing. Great value, great service. This is not a paid advert or anything, I am just happy with what they provide.

Anyhow on to the migrating....

Flying south for the winter


Pro tip: Use MySQL Client to import databases when migrating D7 site, as often you reach the max upload size when using PHPmyadmin (even when the .SQL file is compressed).


I have seen some resources indicating the use of "source" (even apparently the official documentation?) But really "source" is used to execute sql queries and display output, it isn't really meant to import large databases.

Instead we are going to use the MySQL Client via the following commands:
1. Create your database  (mysql > CREATE DATABASE exampleDB;)

2. Change to the directory your sql file is located in.


3. Execute: mysql -u root -p exampleDB < dbarchive.mysql






As an alternative you can dump a sql file into the mysql command line like
mysql -u -p << exampledatabasetable.sql

However the sql file will have to have the use `exampleDB` at the top of the file.


NOTE:
The following variables need to be replaced with your own information:
  • -u username specifies the database username.
  • -p designates that you will be entering a password.
  • exampleDB is the name of the database you are trying to import
  • dbarchive.mysql is the name I gave my backup file, you can name yours however you please.






No comments:

Post a Comment