Install MySQL / MariaDB on Windows Subsystem for Linux (Ubuntu 18.04)

Windows Subsystem for Linux (WSL) let’s you do a lot of interesting stuff inside Windows, biggest of which is installing Linux applications. We’ll look into installing MariaDB on Ubuntu running inside WSL.

Before we start, make sure you have WSL activated and Ubuntu installed, follow this link if you haven’t done so.

Start off by adding repositories required by MariaDB

sudo apt-get install software-properties-common

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mariadb.nethub.com.hk/repo/10.1/ubuntu bionic main'

Update your installation

sudo apt update

Install MariaDB

sudo apt install mariadb-server

You’ll be prompted to set a root password and wait for the installation to continue. Issue the following command once installation is complete:

sudo service mysql start

That’s it.