Install mysql on wsl



  1. Install a distro in windows store.

    I got ubuntu18.04LTS here.

  2. Change sources.list

    backup first.

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    sudo vi /etc/apt/sources.list

    run these commands in vi to replace url.


1. Install mysql

    > meet some problem when install mariadb, so I change to mysql.
    sudo apt install mysql-server
    sudo service mysql start
    sudo mysql_secure_installation

1. Adjusting User Authentication and Privileges

    sudo mysql
    # after enter mysql, check which authentication method each of your MySQL user accounts use with the following command
    # SELECT user,authentication_string,plugin,host FROM mysql.user;
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourPassword';

## Ref

[How To Install MySQL on Ubuntu 18.04](