How to deploy and use MySQL from the Azure Marketplace

MySQL is a popular open source relational database especially for those building on the LAMP stack (aka Linux, Apache, MySQL, Perl/PHP/Python). Installing MySQL on your Linux server can be done manually by following these instructions and running sudo apt-get install mysql-server and configuring your system as needed.

However, there is an even easier way, which is to deploy a pre-configured, ready to run image for running MySQL on Microsoft Azure from BitNami.

Step 1: Deploy MySQL from Azure Marketplace

  1. Navigate to portal.azure.com
  2. Click + New
  3. Search for "MySQL" in the search box & submit
  4. Click MySQL by Bitnami
  5. Click Create

Step 2: Configure the Virtual Machine

MySQL like many solutions in the Azure Marketplace is a pre-configured virtual machine image, so you will need to define what kind of VM you need.

  1. Basics: Configure basic settings
    • Enter a Name for the Virtual Machine
    • Enter a User name for the default admin/root account
    • Select your preferred Authentication type & enter a password or SSH public key
      • For Linux it's recommended to use SSH Public Key. How to generate an SSH key on Windows & Mac/OSX.
    • Select the subscription to deploy the VM in.
      • More often than not you will not need to change this.
    • For Resource Group select an existing one (if this deployment is related to previous resources in Azure) or create a new one.
      • Not sure what a Resource Group is? A resource group is a container that holds related resources for an application. The resource group could include all of the resources for an application, or only those resources that are logically grouped together. Read more about resource groups.
    • Select a Location for the virtual machine
  2. Size: Choose virtual machine size
    • The size of your VM depends greatly on how often your MySQL server is queried, how long those queries take, how big the database is and more. If this is for dev/test purposes A1-A2 is likely good enough. If this is for production I would suggest looking at the D series of VMs or DS series if you need SSD for max disk performance.
  3. Settings: Configure optional features
    • All the defaults here are likey fine if you are just getting started
      • If however, you already have a web app or workload that needs to connect to the database be sure to deploy to the same vnet/subnet if possible.
      • To learn more about Virtual Machines be sure to check out the documentation
    • Click OK
  4. Summary
    • Click OK
  5. Buy
    • MySQL itself is free, however the VM it will be deployed on has a cost (based on the size and disk options you chose).
    • Click Purchase

In a few minutes you will have your new VM with MysQL already installed, network & endpoints configured and everything ready to get you going!

Step 3: Logging into the VM

  1. Use SSH to log into your server
    • ssh <user>@<vm_public_ip>
    • If you chose password you will be prompted for your password, otherwise if you chose to use your ssh public key you can specify it using -i identity_file.
    • Not sure about SSH? Click here to learn more on how to use SSH on Windows, Linux & Mac.

Step 4: Change the default password for MySQL

  1. Remember to change the default password for MySQL
    • mysqladmin -u root -p password
      • You will be prompted to enter your existing password which is bitnami and to confirm your new password.
  2. Verify your new password by logging into MySQL
    • mysql -u root -p

Next Steps

Need to know more about MySQL check out their documentation.

For more solutions that can be easily deployed check out the Azure Marketplace Gallery.

Follow me, @marc_gagne on Twitter.