Moving WordPress databases around

This assumes you have ssh access on a linux system and already have
wordpress databases laying around and that you are very familiar with
the mysql command and unix in general

- Create a fresh database on the server:
mysql -u root -p
grant all privileges on dbname.* to dbusername@localhost identified by ‘dbusernamePassword’;

- Unpack a fresh wordpress release from the wordpress site
tar -xzf latest.tar.gz
mv wordpress aNameYouPick
rm latest.tar.gz

- Copy over a recent good wp-config.php and edit it.

- Install WordPress, open permissons so apache can write to the folder and wp-content

- Set the permalink structure to /%postname%

- Copy the old wp-content folder to the new installation

- Copy anything else that needs to go over.

- Get a dump of the database either from a backup or phpMyAdmin put in dbname.sql on the server

- Edit the dump: make sure the urls are going to work

- Move the dump to the server

- Import the dump on the server from the command line:
mysql -u root -p dbname <dbname.sql

Note if you are using MAMP on a mac you can find the mysql command in
the MAMP folder. Make sure you start the mysql command with the root
user, eg: mysql -u root -p

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>