Add MySQL to Nginx Ubuntu VM on Azure

The next step on my way to run WordPress on an Azure Ubuntu VM with Nginx, is to install MySQL. This is not that complicated, so lets just jump right into it.


  1. Install and Setup Nginx on Azure with a Ubuntu VM
  2. PHP with Configuration
  3. MySQL
  4. Setup WordPress
  5. Configure Nginx and WordPress

Please be aware that the steps I describe in this article may cost you money. Please see the Azure pricing page first.

Like mentioned in the last post, we want to stay up to date, so first up- and upgrade.

$ sudo apt-get update
$ sudo apt-get upgrade -y 

Install MySQL:

Just enter:

$ sudo apt-get install mysql-server -y 

While installing, you will be asked to enter a password for your MySQL root account, just enter a password here, you can change it later on.

MySQL Ubuntu Azure enter Root Password

MySQL Security Settings:

After the installation we want to configure some things, regarding the MySQL security. To do so, just enter the following command:

$ sudo mysql_secure_installation 

First you will be prompted for the root password you entered before. Hit Y only if you want to change the root password.

MySQL Ubuntu Azure change Root Password
Next, the process will ask you a few more questions, just answer those with Y.

  • Remove anonymous user accounts

MySQL Ubuntu Azure remove anonymous user

  • Remove remote root login

MySQL Ubuntu Azure disable remote root login

  • Remove the testing DB

MySQL Ubuntu Azure remove the test DB

  • Reload privilege tables

MySQL Ubuntu Azure reload privilege tables

That is basically it. Next we want to install WordPress!

You may also like...