SQLite - Install and setup SQLite in MS Windows

By xngo on August 6, 2019

Overview

SQLite is a super small SQL database engine. It is self-contained within 1 single file and doesn't require any configuration. It is mostly used as an embedded database. In this tutorial, I will show you how to install and setup SQLite in MS Windows.

Download the latest version

  1. Go to https://www.sqlite.org/download.html.
  2. From the Precompiled Binaries for Windows section, download the zip file that contains the bundle of command-line tools for managing SQLite database files(e.g. sqlite-tools-win32-x86-3290000.zip).
  3. Unzip the file.

Setup the environment variable

After you unzip the file, you can use SQLite right away by executing sqlite3.exe but you have to first go to the directory where sqlite3.exe is located and then execute it from there. In order to run SQLite anywhere from the command line, add the directory path to the PATH environment variable. Here is how to do it.

MS Windows 10

  • Press Windows key + q to search for environment term.
  • Select Edit the system environment variable. The System Properties window will open.
  • At the bottom right, click on Environment Variables... button.
    Environment variables dialog
  • Under the User variables for section, select Path and click on Edit... button.
    Environment variables - path dialog
  • Click on the New button to add the directory path where sqlite3.exe is located.
    Environment variables - add path dialog

Test SQLite

Open your command prompt and execute sqlite3.exe. It should show something like the following.

C:\Users\xuan.ngo>sqlite3
SQLite version 3.29.0 2019-07-10 17:32:03
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>

To quit SQLite console, execute .quit.

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.