My desktop computers run Microsoft Windows, but in my job I manage Ubuntu Linux servers. Setting up a local dev environment under Windows is a bit of a pain, so I decided to give the Windows Subsystem for Linux (WSL2) a go, using the Ubuntu 20.04 LTS distribution.
To install the LAMP components:
sudo apt install lamp-server^
sudo service apache2 start
sudo usermod -d /var/lib/mysql/ mysql
sudo service mysql start
Note that you need to access MySQL using sudo:
sudo mysql -u root -p
I then tried to install PHPMyAdmin:
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
This is where I ran into difficulties, with the error trying to configure the PHPMyAdmin user:
ERROR 1819 (HY000) at line 1: Your password does not satisfy the current policy requirements
Apparently MySQL 8 has changed the authentication system and the Secure Installation script also causes issues. In the end I temporarily disabled the password validation:
mysql> UNINSTALL COMPONENT "file://component_validate_password";
Query OK, 0 rows affected (0.02 sec)
I was then able to complete the PHPMyAdmin configuration and re-enable validation:
mysql> INSTALL COMPONENT "file://component_validate_password";
Query OK, 0 rows affected (0.01 sec)
I also created a new PHPMyAdmin user who could create databases following the linked instructions.
Note that the web directory seems to have defaulted to /var/www/ instead of our standard /srv/www/, but this can be configured in Apache later.
I found that I couldn’t connect to my localhost and needed to restart WSL2 (possibly after restarting the PC). These instructions were useful.
# PowerShell (admin) Restart-Service LxssManager # CMD (admin) net stop LxssManager net start LxssManager