Move your Wordpress database to your own Azure VM :)

Play Move your Wordpress database to your own Azure VM :)
Sign in to queue


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 :)

Quick guide summary:

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

- download & install 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 -udb-user -p -hdb-host db-name > C:\filedump.sql

- import it to your newly created DB:

mysql.exe -uwordpressuser -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





Right click to download this episode

The Discussion

  • User profile image

    You must have a killer blog to justify the overhead in cost and maintenance involved (VM OS, MySQL, general database management and monitoring) which are not covered within this post.

    It doesn't make sense in my opinion, unless for an interesting hobby project.

  • User profile image

    @Bronsdijk:It's pretty useful if you, for example, already have a BizSpark allowance and run your devblog locally :) Pure MySQL-Service subscriptions aren't necessarily cheap externally either - so in this constellation it might be even a way of saving costs for the time being.

    I don't claim that this is or should be a silver bullet :)

  • User profile image

    @KrisRothe Hi Thanks for the information. It is really useful. I am really in a need of this. 

Add Your 2 Cents