codegurukool.com · Free coding tutorials & online compiler

Home › SQL Tutorial › SQL installation

SQL installation

Full step-by-step installation for Windows, macOS and Linux.

Install SQLite (simplest)

  1. Windows: open sqlite.org/download.html, download the sqlite-tools zip for Windows and extract it to C:\sqlite. Add C:\sqlite to your PATH: open the Start menu, search Edit the system environment variables, click Environment Variables, select Path, click Edit, then New, and paste C:\sqlite.
  2. macOS: SQLite is already installed. To get a newer one run brew install sqlite.
  3. Linux: run sudo apt install sqlite3.
  4. Check it with sqlite3 --version.

Create your first database

  1. Run sqlite3 test.db.
  2. Type CREATE TABLE pets (id INTEGER PRIMARY KEY, name TEXT); and press Enter.
  3. Type INSERT INTO pets (name) VALUES ('Tom');.
  4. Type SELECT * FROM pets; to see your row.
  5. Type .quit to leave.

Install MySQL (optional)

  1. Download MySQL Community Server from mysql.com/downloads.
  2. Windows and macOS: run the installer, choose the default setup and set a password for the root user. Linux: run sudo apt install mysql-server.
  3. Check it with mysql --version.
  4. Connect with mysql -u root -p and enter your password.

If something goes wrong

This page also runs SQLite in your browser, so you can practise without installing anything.

Example code

SELECT 'SQL is working' AS message;

Run this code in the online editor

← SQL introductionSQL SELECT and DISTINCT →