CODEMONDAY
Published in

CODEMONDAY

How to access SQLite file in WSL2

My case is when I initialize the database in WSL2 and try to access it with GUI tool on the Window, for example, Dbeaver, DB for SQLite etc.

Possible Cause

From internet search, seem like the WSL path \\wsl$\Ubuntu ... is the problem.

So the file must be on the Window path

Linking Workaround

Now we move the database file to Window path.

As an example foo.db is in my desktop.

Now link it into our WSL machine. Note that we need flag -s.

Also note that way to access Window’s file in WSL2 is through /mnt/c/...

Now we can:

  1. Access from GUI from Window machine
  2. Have convenient short path that can access from WSL machine

Hope this help !

--

--

Web App | Mobile App | Digital & IT Solution

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store