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
CREATE DATABASE dbname;
grant all privileges on dbname.* to dbusername@localhost identified by ‘dbusernamePassword’;
FLUSH PRIVILEGES;
exit;

- Unpack a fresh wordpress release from the wordpress site
wget http://wordpress.org/latest.tar.gz
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

How to export a local WordPress Blog to a remote WordPress Blog

Awesome process for  uploading a local database to a remote machine It just worked! Original here.

Summary

  • Login to your local phpMyAdmin, select the database from the dropdown. Click on the Export tab:
    • Under the Export tab, Export section, click Select All
    • Under the Structure field, check “Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT”
    • Check Save as File
    • Then click Go and it will prompt you to download a SQL file
  • Open the exported SQL file in a text editor substitute all local URLs with the remote URLs, eg:
    replace: http://localhost:8888/crp with: http://74.220.207.118/~porcaroo/crp
  • ALSO:  Make sure any hard coded and relative paths are changed.  For example, if you changed the name of a database on the local machine from “subway” to “nycsubwayexplorer”  make sure all references like /subway/ are changed to /nycsubwayexplorer/
  • Import database to remote server:
    • Login to your server cPanel, go to MySQL Databases, create a new database and assign a user.   Delete it if it already exists.  Now go to phpMyAdmin, select the database (the one that was just created) from the dropdown, click on the Import tab, browse the SQL file and click Go.
    • Give the new user all permissions
  • Copy the local wordpress installation to the remote server
  • Modify the wp-config.php file to be what the server wants.   I actually have been keeping a wp-config,php.local and a wp-config.php.remote and then copying them to wp-config.php as appropriate.
  • I have been keeping everything the same in the wp-config.php for each new database I create except the database name, and then I regenerate the authorization keys

Install Word Press on a Local Machine

  • Download MAMP
  • I am using MAMP Pro. Unpack and install it.
  • Create database with name porcaroo_blendnik in local MAMP myPhpAdmin
  • Unpack wordpress-2.8.4.zip and edit config.php
  • Go to localhost:8888/blendnik/wp-admin/install.php and follow the directions
  • Install the necessary plugins (FLV and Flash Grand)
  • Make a couple of posts with an image and a video and text
  • The php.ini files for MAMP need to have their memory limit upped to something bigger than 8MB, I made it 100MB.  The FLAGallery  complained then I had to go on a wild goose chase to figure out why.
  • Used wordpress classic theme
  • When adding the FLA gallery had to make a custom size for it to look right.
  • When inserting the pictures and videos it was possible to use
    relative paths, eg: wp-content/movies/foo.mov
  • OK there are problem with .flv files.  Stick with QuickTime
  • Another thing:  There was one point where I ran into a problem where phpMyAdmin stoppped working.  The way to make it come back was to delete MAMP and MAMP Pro and re-install from the .dmg file, license code=MP-0FA4-5FDC-421D-07800