devnotes.

Installing MySQL & Connecting

Windows

  1. Download the MySQL Installer from dev.mysql.com/downloads/installer.
  2. Choose Developer Default (server + Workbench + connectors).
  3. Pick Use Strong Password Encryption, set the root password, 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 -p in a shared shell (-psecret) — it lands in your shell history and the process list. Use -p alone or a ~/.my.cnf file with chmod 600.

Install MySQL on Windows, Linux, macOS and Docker | DevNotes