Skip to content

Instantly share code, notes, and snippets.

@stormwild
Last active August 23, 2022 15:17
Show Gist options
  • Save stormwild/cb3cd7369897ce9322832be20535b96d to your computer and use it in GitHub Desktop.
Save stormwild/cb3cd7369897ce9322832be20535b96d to your computer and use it in GitHub Desktop.
SQLite 3 on WSL

SQLite 3

WSL

Install SQLite 3 on WSL

Step by step guide

  1. Open Debian distro through WSL command:

    wsl -d Debian
    
  2. Update Debian packages:

    sudo apt update
    

    You need to type user password.

  3. Install SQLite 3 using the following command:

    sudo apt install sqlite3
    

    Type Y to continue when asked.

  4. Wait until the installation is completed.

  5. Verify SQLite version:

    $ sqlite3 --version
    3.16.2 2017-01-06 16:32:41 a65a62893ca8319e89e48b8a38cf8a59c69a8209
    

Test SQLite 3

  1. Create a database named test.db using the following command:

    sqlite3 test.db
    

    The command outputs the following:

    SQLite version 3.16.2 2017-01-06 16:32:41
    Enter ".help" for usage hints.
    sqlite>
    
  2. Check database list using the following command:

    sqlite> .databases
    

    The output looks like the following screenshot:

    sqlite> .databases
    main: /path/to/samplephp/samplephp.db
    sqlite> .exit
    
  3. Type .exit to exit the CLI.

  4. Run command ls and you will find the file database is created.

    $ ls
    test.db
    

PHP

SQLite

How to install the SQLite PDO extension on Ubuntu

PDO_SQLITE driver not present.. what to do?

Install PHP SQLite

sudo apt-get install php-sqlite3

Tutorials

SQLite PHP: Connecting to SQLite Database From PHP Using PDO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment