1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tutorial: Install WordPress on Windows with MariaDB in replication.

Install WordPress on Windows with MariaDB in replication.

  1. sbagmeijer
    In this guide I will show some simple steps of how to create a WordPress blog on Windows, I am going to do this manual in this guide as I feel that way you learn how all applications have been setup.
    If you want to do it the quick way you can simply use: http://www.microsoft.com/web/wordpress

    This guide was tested with:
    Windows 8 Professional
    Windows 2012 Standard
    Windows 2008

    I used for this setup the following servers that have Windows Server 2012 Standard edition installed.

    wordpress01: 192.168.1.46 / 4GB ram / 2 cpu
    mariadb01: 192.168.1.47 / 4GB ram / 2 cpu
    mariadb02: 192.168.1.48 / 4GB ram / 2 cpu

    Workgroup: ULYAOTH

    You can of-course just install everything on one server and simply remove the whole MariaDB replication part, and just install do a single database installation of MariaDB on the same server as WordPress.

    Now lets get to work!

    Step 1: Download MariaDB (Only on the servers mariadb01 and mariadb02)
    You can download MariaDB from: http://www.mariadb.org

    Direct link to the package:
    https://downloads.mariadb.org/inter...4.msi/from/http:/ftp.ddg.lth.se/mariadb?serve

    Step 2: Install MariaDB (Only on the servers mariadb01 and mariadb02)
    Start the installation by double clicking the "mariadb-10.0.12-winx64.msi" file.

    You should see a screen like this now:
    [​IMG]
    Just press on next.

    [​IMG]
    On this window click the box before the text "I accept the terms in the License Agreement" ofcourse read the terms first! and then lick "Next".

    [​IMG]
    Everything is fine on this window so press "Next" again.

    [​IMG]
    On this window fill in a "root" password for the mysql admin account and I normally click also "Use UTF8 ad default server's character set" however if you use plain English you can ignore this one.
    And again press "Next"

    [​IMG]
    On this page just leave everything default and press "Next". (I change the Buffer pool Size to 512mb but this is not required)

    [​IMG]
    Since my two Database servers will not have internet connection I just click "Next" on this window.

    [​IMG]
    Press on "Install" to start the installation of MariaDB.

    [​IMG]
    Congratulations you now have installed MariaDB so just click on "Finish" to close the installation.

    Step 3: Change the MariaDB config files (Only on the servers mariadb01 and mariadb02)
    Open "C:\Program Files\MariaDB 10.0\data\my.ini" (Only on the servers mariadb01 and mariadb02)

    On mariadb01 under the "[mysqld]" part add the following:
    server-id=1
    log-bin=mysql-bin
    binlog_format=mixed

    On mariadb02 under the "[mysqld]" part add the following:
    server-id=2
    log-bin=mysql-bin
    binlog_format=mixed

    Step 5: Restart the database servers (Only on the servers mariadb01 and mariadb02)
    Just reboot the windows servers to test that mariadb will correctly start automatically and take into affect the new configuration.

    Step 6: Open the Graphical MariaDB user-interface (Only on the servers mariadb01 and mariadb02)
    Start HeidiSQL this was installed with MariaDB.

    You should see a window like this when it is started:
    [​IMG]
    click on "New" at this window

    [​IMG]
    Name your session "MariaDB01" or "MariaDB02" Depending on the server you are, and full in your root password and then press "Save" and then on "Open".

    [​IMG]
    You should see this now.

    Step 7: Create a replication user (mariadb01 only)
    Inside the graphical interface click on the "Query" tab next to "Host: 127.0.0.1".

    On the "Query" tab add the following:
    GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' IDENTIFIED BY 'replication007';
    GRANT REPLICATION SLAVE ON *.* TO 'repl'@'192.168.1.48' IDENTIFIED BY 'replication007';
    FLUSH PRIVILEGES;
    SHOW MASTER STATUS;

    And then press on the run button, so it should look as below:
    [​IMG]

    Mark down the result you will see for me this is
    File: mysql-bin.000003
    Position: 826

    Step 8: Configure the slave inside the graphical mariadb interface (mariadb02 only)
    Inside the graphical interface click on the "Query" tab next to "Host: 127.0.0.1".

    On the "Query" tab add the following:
    STOP SLAVE;
    CHANGE MASTER TO MASTER_HOST='192.168.1.47', MASTER_USER='repl', MASTER_PASSWORD='replication007', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=826;
    START SLAVE;
    SHOW SLAVE STATUS;

    It should look something like:
    [​IMG]

    You can have a look in the results window it should say something like:
    Slave_IO_Running: Yes
    Slave_SQL_Running: Yes

    If you do not see this then make sure you change the ip at "MASTER_HOST='192.168.1.47'" to your "mariadb01" server.

    Step 9: Create the Wordpress database (mariadb01 only)
    Inside the graphical interface click on the "Query" tab next to "Host: 127.0.0.1".

    On the "Query" tab add the following:
    CREATE DATABASE wordpress;
    GRANT ALL PRIVILEGES ON wordpress.* TO "ulyaothblog"@"%" IDENTIFIED BY "ulyaoth007";
    GRANT ALL PRIVILEGES ON wordpress.* TO "ulyaothblog"@"localhost" IDENTIFIED BY "ulyaoth007";
    GRANT ALL PRIVILEGES ON wordpress.* TO "ulyaothblog"@"192.168.1.47" IDENTIFIED BY "ulyaoth007";
    FLUSH PRIVILEGES;
    SHOW DATABASES;

    It should look as following:
    [​IMG]

    Step 10: Test if replication works (mariadb02 only)
    Inside the graphical interface click on the "Query" tab next to "Host: 127.0.0.1".

    On the "Query" tab add the following:
    SHOW DATABASES;

    It should show now the wordpress database on your slave also as below:
    [​IMG]

    Congratulations this was all when it comes to the database part! just remember the information:
    Database name: ulyaothblog
    Password: ulyaoth007

    Of-course I assume you changed this accordingly to something else :)!

    Now all that is left is to actually create the wordpress server itself so lets continue.

    Step 11: Install IIS
    Go to "Server Manager" and choose "Add Roles and Features Wizard" from the list here choose "Web Server (IIS)" also select to install the CGI module! now go further and let it install.

    Step 12: Download WordPress
    Go to "https://wordpress.org/download/" and download WordPress.
    Direct URL: https://wordpress.org/latest.zip

    Step 13: Extract wordpress
    Extract WordPress to "C:\ulyaoth\wordpress\"

    Step 14: Download php
    Go to "http://windows.php.net/" and download php from there.
    Direct link: http://windows.php.net/downloads/releases/php-5.5.14-Win32-VC11-x64.zip

    Please be aware php 64bit that I am using is still experimental, if you will use this in production please go for the 32bit version:
    http://windows.php.net/downloads/releases/php-5.5.14-Win32-VC11-x86.zip

    Step 15: Extract php
    Extract PHP to "C:\PHP\"

    Step 16: Add php to your system path
    Right click on "This PC" and choose "Properies" on the right bottom site next to your computer and full computer name click on Change settings.
    On the window that opens go to the Advanced tab and click on "Environment Variables".
    At the bottom box called "System Variables" search for "Path" in the list and click on "Edit"
    Now a new window should open and at the "Variable Value" at the very end add this to the line ";C:\PHP"

    So it should look like this:
    [​IMG]
    If it looks like that just press "OK" three times to save everything.

    Step 17: Rename php.ini config
    Go to "C:\PHP\" and rename the file "php.ini-production" to "php.ini".

    Step 18: Open IIS Manager and stop the "Default Web Site"

    Just press the stop button like you see below in the picture:
    [​IMG]

    Step 19: Create a new website for your blog as shown below
    Right click on "sites" in the left part of IIS Manager and click "Add Website".

    Fill it in something like this:
    [​IMG]

    Step 20: Make it so IIS can execute php scripts

    While still inside the IIS Manager click on your website then double click Handler Mappings.
    The window should change simply right click and choose "Add Module Mapping".

    Now fill it in as following:
    Request path: *.php
    Module: FastCgiModule
    Executable: C:\PHP\php-cgi.exe
    Name: PHP

    If it looks as the picture below press on "OK".
    [​IMG]

    if you do not see "FastCgiModule" then it means you did step 11 wrong and not installed the cgi module also.

    Step 21: Add "index.php" ad a Default Document
    While still inside the IIS Manager click on your website and then double click Default Document.
    The window should change simply right click and choose "Add".

    Now fill it in as following:
    Name: index.php

    It should look like this:
    [​IMG]

    Step 22: Download Visual C++ Redistributable for Visual Studio 2012
    Download installer at the following location: http://www.microsoft.com/en-us/download/details.aspx?id=30679#

    Step 23: Install Visual C++ Redistributable for Visual Studio 2012
    Double click "vcredist_x64.exe" and install it.

    [​IMG]
    Click on "I agree to the license terms and conditions" and then install.

    [​IMG]
    Press on "Close" to finalize the installation.

    Step 24: Edit php.ini
    Open "C:\PHP\php.ini" and change the following lines:

    Change:
    ;date.timezone =

    To:
    date.timezone = Europe/Stockholm

    You might want to find you own timezone at: http://pl.php.net/manual/en/timezones.php

    Also Change:
    ;extension=php_mysql.dll

    To:
    extension=C:\PHP\ext\php_mysql.dll

    Step 25: Install Wordpress.
    Go to your websites domain name for me "http://blog.ulyaoth.net" and follow the steps below.

    [​IMG]
    Press on "Create a Configuration File" to continue the installation.

    [​IMG]
    Press on "Let's go!" to continue the installation.

    [​IMG]
    Fill in all the information as I did of-course use your information from the previous steps and then press on "Submit".

    [​IMG]
    On this tab you have to copy all information and copy it inside a notepad and then save the file as wp-config.php in "C:\ulyaoth\wordpress\"
    So you should end up with a file like this: C:\ulyaoth\wordpress\wp-config.php

    Once done you can press on "Run the install".

    [​IMG]
    Fill this in accordingly so it has what you wish and then press on "Install WordPress"

    [​IMG]
    Congratulations you have no successfully installed WordPress you can press "Log in" to go to the WordPress control panel.

    This was it if you now go to your website so for me "http://blog.ulyaoth.net" you will see WordPress up and running.

    [​IMG]

    As always if you see any mistakes or improvements please let me know! Again you can install WordPress more easy as I wrote in the top of the website but by doing it manual you learn some IIS, some php and you have a Master/Slave setup for your database.

    I hope it helps someone! :)

    [​IMG]