Windows
- Download the MySQL Installer from dev.mysql.com/downloads/installer.
- Choose Developer Default (server + Workbench + connectors).
- Pick Use Strong Password Encryption, set the
rootpassword, and let it configure MySQL as a Windows service.
Linux (Ubuntu/Debian)
sudo apt update
sudo apt install mysql-server
sudo systemctl enable --now mysql
sudo mysql_secure_installation
macOS
brew install mysql
brew services start mysql
mysql_secure_installation
Docker (fastest for learning)
docker run --name mysql8 \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=practice \
-p 3306:3306 -d mysql:8.4
docker exec -it mysql8 mysql -uroot -psecret
Connecting with the CLI
mysql -u root -p # prompts for password (safest)
mysql -h 127.0.0.1 -P 3306 -u app -p practice
Useful client commands:
SELECT VERSION(); -- server version
SHOW DATABASES; -- list databases
USE practice; -- pick a database
SHOW TABLES; -- tables in current database
STATUS; -- connection info
\q -- quit
GUI tools
- MySQL Workbench — official; modelling, query editor, admin.
- DBeaver / TablePlus / HeidiSQL — light, multi-database clients.
- phpMyAdmin — browser-based, common on shared hosting.
Tip: never put a password directly after
-pin a shared shell (-psecret) — it lands in your shell history and the process list. Use-palone or a~/.my.cnffile withchmod 600.