Home › SQL Tutorial › SQL installation
SQL installation
Full step-by-step installation for Windows, macOS and Linux.
Install SQLite (simplest)
- Windows: open
sqlite.org/download.html, download the sqlite-tools zip for Windows and extract it toC:\sqlite. AddC:\sqliteto your PATH: open the Start menu, search Edit the system environment variables, click Environment Variables, select Path, click Edit, then New, and pasteC:\sqlite. - macOS: SQLite is already installed. To get a newer one run
brew install sqlite. - Linux: run
sudo apt install sqlite3. - Check it with
sqlite3 --version.
Create your first database
- Run
sqlite3 test.db. - Type
CREATE TABLE pets (id INTEGER PRIMARY KEY, name TEXT);and press Enter. - Type
INSERT INTO pets (name) VALUES ('Tom');. - Type
SELECT * FROM pets;to see your row. - Type
.quitto leave.
Install MySQL (optional)
- Download MySQL Community Server from
mysql.com/downloads. - 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. - Check it with
mysql --version. - Connect with
mysql -u root -pand enter your password.
If something goes wrong
'sqlite3' is not recognized: the PATH step is missing or the terminal was not reopened.- MySQL says Access denied: the password is wrong. Use the root password you set during install.
This page also runs SQLite in your browser, so you can practise without installing anything.
Example code
SELECT 'SQL is working' AS message;