Fork me on GitHub

Wordpress migration procedure

Extract source site filesystem

tar -czf mySite.tgz /var/www/mySite

Extract source site database

mysqldump -u mySite -p mySite > mySite.sql

Transfert source fs and db to target site

  • Extract tar archive

    tar -czf mySite.tgz
    
  • Import database

Migrate database

Wordpress stores url in database, some of them can be serialized so wa can't just replace them with a bash script.

The best and easier way is to use this project interconnectit/Search-Replace-DB :

  • download it
  • upload it to the wordpress root
  • open a browser at the matching url
  • fill the form to migrate your database

Install keepass and kee on linux

install keepass2

sudo add-apt-repository ppa:jtaylor/keepass
sudo apt-get update && sudo apt-get install keepass2

install firefox addon 'kee'

download KeePassRPC.plgx plugin

download KeePassRPC.plgx plugin

sudo mkdir /usr/lib/keepass2/plugins
sudo cp 'KeePassRPC.plgx' '/usr/lib/keepass2/plugins/'
sudo apt-get install mono-complete

Restart keepass and firefox

you should be prompt about kee to authorize keepass

mySQL to postgreSQL schema conversion

Purpose

I was looking for a tool that convert a mysql db to a pgsql one. philipsoutham/py-mysql2pgsql does the trick and saved my day!

Install

sudo apt-get install python-pip
pip install py-mysql2pgsql

Configure

Edit configuration in mysql2pgsql.yml

# if a socket is specified we will use that
# if tcp is chosen you can use compression
mysql:
 hostname: localhost
 port: 3306
 socket: /var/run/mysqld/mysqld.sock
 #socket: /tmp/mysql.sock
 username: emedia
 password: emedia
 database: emedia
 compress: false
destination:
 # if file is given, output goes to file, else postgres
 file: /vagrant/shared/migrationMysql2Pgsql.sql
 postgres:
  hostname: localhost
  port: 5432
  username: mysql2psql
  password:
  database: mysql2psql_test

# if tables is given, only the listed tables will be converted.  leave empty to convert all tables.
only_tables:
- lti2_consumer
- lti2_context
- lti2_nonce
- lti2_resource_link
- lti2_share_key
- lti2_tool_proxy
- lti2_user_result
# if exclude_tables is given, exclude the listed tables from the conversion.
#exclude_tables:
#- table3
#- table4

# if supress_data is true, only the schema definition will be exported/migrated, and not the data
supress_data: true

# if supress_ddl is true, only the data will be exported/imported, and not the schema
supress_ddl: false

# if force_truncate is true, forces a table truncate before table loading
force_truncate: false