have to admit that WSL is not befect.
General tutorial always bring up ERROR:
1 | service mysql start |
Luckily, I found an issue in WSL Github:(a bit modified)
1.Remove MySQL 8.x:
1 | sudo apt-get purge mysql-server mysql-client |
2.Change to MySQL 5.x candidate:
get download url from https://dev.mysql.com/downloads/file/?id=487007 or download the .deb
directly
1 | wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb |
3.Double check current apt policy of MySQL is 5.x:
1 | sudo apt policy mysql-server (it will show 5.x is the default candidate) |
4.Install MySQL 5.x
1 | sudo apt-get -y install mysql-server |
5.Change to MySQL 8.x candidate
1 | sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb (select 8.x) |
however, I still find that the candidate is 5.x.
1 | sudo apt policy mysql-server |
Continue the tutorial and I found out that it will download 8.x after all, so just go ahead!
6.Install MySQL 8.x
1 | sudo apt-get -y install mysql-server |
search for a line “. /usr/share/mysql/mysql-helpers” and change it to
“. /usr/share/mysql-8.0/mysql-helpers”
7.Upgrade system tables to MySQL 8.x
1 | sudo service mysql start #(this should start without error) |
then enjoy your MySQL.