How to use mysql in wsl without installing any separate MySQL client for Windows.
Asked
Active
Viewed 4,225 times
5
-
Using the [MySQL Command-Line Tool](https://dev.mysql.com/doc/refman/5.7/en/mysql.html) from the WSL itself. – wchiquito Nov 28 '17 at 05:36
2 Answers
2
Inside your bash command line:
sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation

Ryan
- 22,332
- 31
- 176
- 357

juanzapatac
- 78
- 8
1
Here is how I have accessed MySQL installed in Windows 10 through WSL:
1. Create a user with remote access
CREATE USER 'newuser'@'%' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';
FLUSH PRIVILEGES;
2. Update mysql.ini
bind-address=0.0.0.0
# skip-external-locking
3. Test connection using local IP
>mysql -h192.xxx.xx.xx -P 3306 -unewuser -p

kashaziz
- 461
- 4
- 11
-
See related articles: https://serverfault.com/q/257513/119666 and https://stackoverflow.com/q/54377052/470749 – Ryan Jun 13 '21 at 20:03