AJain2810
AJain2810

Reputation: 435

How to use MySQL in WSL (Windows Subsystem for Linux)?

How to use mysql in wsl without installing any separate MySQL client for Windows.

Upvotes: 5

Views: 4935

Answers (2)

juanzapatac
juanzapatac

Reputation: 78

Inside your bash command line:

sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation

Upvotes: 2

kashaziz
kashaziz

Reputation: 491

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

Upvotes: 1

Related Questions