Skip to content

Working with WSL

Zach Toogood edited this page Feb 5, 2023 · 7 revisions

Working with WSL

Build Speed

If you're going to build from WSL, it's better to clone your repo to somewhere like /home/. It is incredibly slow to use /mnt/c/.

Connecting to MariaDB on Windows from WSL

WSL acts like another machine on your local network, so if you are hosting your database on your Windows machine but running your server processes in WSL, you'll need to configure things differently.

In WSL

Find the information about your Windows machine:

cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.18.64.1

NOTE: This IP appears to change on WSL startup, you'll have to come in here and fetch the new IP whenever it changes.

Set the IP found here in network.lua settings.

xi.settings.network =
{
    SQL_HOST     = "172.18.64.1",
    
    ...

In Windows

If you need to give your WSL instance permissions to use MariaDB, you can create a user for it (using ):

Get the IP of your WSL instance:

wsl hostname -I

Create a user at that IP:

CREATE USER 'root'@'172.30.167.123' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.30.167.123' ;
FLUSH PRIVILEGES;
Clone this wiki locally