Move your Wordpress database to your own Azure VM :)

You may, for whatever reason, want to move your Wordpress database (MySQL) from wherever it is hosted right now to a VM hosted in Azure. This comes especially handy, if you have everything else on Azure already, if you have an MSDN subscription or BizSpark / DreamSpark allowance. So in this tutorial I will show you how to

- create a new Azure VM (Windows Server 2012)

- Set Up MySQL

- configure it for Wordpress

- import the old wordpress database

- expose the required endpoint

- configure wordpress to connect to your new VM as DB server

the best thing: it's quite simple and quick to work out :)

Follow @kris\_rothe

Quick guide summary:

- set up a Windows Server 2012 VM (quick create) - pay attention to the VM size

- download & install MySQL: dev.mysql.com/downloads/mysql -> pick "Server only"

- check for Advanced Settings; also activate MySQL Startup at system start

- set up your root password AND a dedicated mysql user for wordpress (for "all hosts")

- from the start screen, start the MySQL command line and log in

- CREATE DATABASE your_new_db_name;

- go to the start screen again and run a command line as administrator

- navigate to C:\Program Files\MySQL\MySQL Server 5.6\bin

- retrieve a dump of your current db:

mysqldump.exe -e -u db-user -p -h db-host db-name > C:\filedump.sql

- import it to your newly created DB:

mysql.exe -u wordpressuser -p -hlocalhost db-name < C:\filedump.sql

- now go to the start screen and run Windows Powershell as administrator and execute:

New-NetFirewallRule -DisplayName "MySQL56" -Direction Inbound -Protocol TCP -LocalPort 3306 -Action Allow -Profile Public

Finally go to your Azure management portal of the VM, navigate to Endpoints and create a new endpoint. Select the name MySQL and it will automatically be configured correctly.

Done! Now you just need to change the details (hostname, db name, db user, db password) in your wp-config.php