The short version
- A client is a messenger. It sends SQL text and shows the rows the server sends back.
- Pick by task. Command line for quick checks and scripts, a GUI to browse and click.
- If you install one GUI, install DBeaver Community. It is free and speaks both engines.
- Five facts make a connection. Host, port, user, database, TLS.
- Load sample data. An empty server teaches nothing, so start with
shop. - Docker gives you a throwaway server. One line to start it, one line to delete it.
One idea: a client is a messenger
The server owns the data: mysqld.exe for MySQL, postgres.exe for PostgreSQL. A client is anything that connects, sends a statement and reads the result, so the mysql prompt, Workbench, DBeaver and your company's web application are all clients. What differs between them is convenience; chapter 2 traced the rest of the path.
Remember
A query behaves the same wherever you type it. A GUI button is a statement you did not have to type, so when a tool falls short, ask an AI assistant for the SQL.
MySQL clients
| Tool | Best for | Note |
|---|---|---|
mysql command line | Quick checks, one-line statements, running a .sql file, Task Scheduler jobs | Free, ships with the server in C:\Program Files\MySQL\MySQL Server X.Y\bin, which chapter 4 added to PATH. |
MySQL Shell 26.7.1 (mysqlsh) | Dumps and loads, upgrade checks, InnoDB Cluster | Free, separate download. One version serves 8.4, 9.7 and 26.7 servers; starts in SQL mode. |
| MySQL Workbench 26.7 | Browsing a schema, editing queries, visual EXPLAIN (chapter 10), administration pages | Free, dev.mysql.com/downloads/workbench. A new Electron app built on MySQL Shell, for 8.4 and newer. Needs the Visual C++ 2019 runtime. |
| MySQL Workbench 8.0.47 | Nothing new | The last release of the old line, declared end of life. Tutorials, screenshots and the manual still show it, so expect a mismatch. |
| HeidiSQL | Editing rows in a grid, exporting to CSV or SQL, copying a table between servers | Free, open source, Windows-native, opens in a second. Also MariaDB, PostgreSQL, SQL Server and SQLite. |
| DBeaver Community 26.2.x | Both engines in one window, ER diagrams from existing tables, schema compare, data transfer | Free, Apache 2.0, Java and JDBC. The data transfer wizard copies tables between engines (chapter 17). |
| VS Code SQLTools | SQL next to your code | Free, open source, with separate driver extensions per engine. The old MySQL Shell for VS Code extension is discontinued; its features moved into Workbench 26. |
| Percona PMM | Graphs and dashboards for both engines | Free, open source, runs as Linux containers (Docker Desktop with WSL 2). No Windows agent, so it watches a Windows MySQL as a remote instance. |
# One statement, then exit. -p with no value prompts for the password.
mysql -u root -p shop -e "SELECT id, name, city FROM customers"
Careful
Every MySQL tutorial loads a file with mysql -u root -p < file.sql, and in PowerShell that fails, because PowerShell reserves <. Hand the line to cmd.exe /c "...", or type source C:/path/file.sql inside mysql; for mysqldump, use --result-file= instead of >, which also keeps line endings from becoming CRLF.
MySQL Shell (mysqlsh): the modern one
Behind \js and \py are the utilities a DBA installs it for. util.dumpInstance(), util.dumpSchemas() and util.loadDump() write parallel, compressed dumps, which Oracle's manual prefers to mysqldump for anything large (chapter 15). util.checkForServerUpgrade() finds what will break in the next version, and dba.* and cluster.* build InnoDB Cluster, ClusterSet and ReplicaSet.
mysqlsh root@localhost:3306/shop
SELECT status, COUNT(*) FROM orders GROUP BY status;
\js
util.dumpSchemas(["shop"], "C:/backups/shop-2026-09-27", {threads: 4})
util.checkForServerUpgrade()
\sql
Paid Enterprise tools, and the free alternatives
MySQL Enterprise Backup (mysqlbackup, hot physical InnoDB backups) is paid Enterprise Edition only, and MySQL Enterprise Monitor reached end of life on January 1, 2025. Your free backup options are mysqldump, the Shell dump utilities, the Clone plugin and the binary log; mysqlpump was removed in 8.4 and Percona XtraBackup does not run on Windows. Free monitoring is the Performance Schema and sys schema (chapter 16), plus PMM for graphs.
PostgreSQL clients
| Tool | Best for | Note |
|---|---|---|
psql | Quick checks, running a file, scripts and scheduled jobs | Free, comes with the EDB installer from chapter 5, in C:\Program Files\PostgreSQL\18\bin. |
| pgAdmin 4 9.18 | Object browser, Query Tool with an EXPLAIN visualizer, session and lock dashboards, role dialogs | Free. A web app in a desktop window, so it asks for a master password. Its Backup and Restore dialogs run pg_dump and pg_restore and show you the command; copy that into a script. The installer bundles an older copy than the standalone build. |
| DBeaver Community, HeidiSQL | PostgreSQL in the same window as MySQL | Both connect natively. If your PostgreSQL work is occasional, you may never need pgAdmin. |
| VS Code PostgreSQL extension | Object explorer, IntelliSense, plan viewing, a Copilot chat participant | Free, Microsoft's own (ms-ossdata.vscode-pgsql), generally available since late 2025, PostgreSQL only. |
psql: the command line, with backslash commands
Anything that starts with a backslash is a meta-command that psql handles itself; everything else goes to the server. They are wrappers over the catalog tables, like MySQL's SHOW TABLES.
| Command | What it does | MySQL equivalent |
|---|---|---|
\l | List databases | SHOW DATABASES |
\c shop | Connect to database shop | USE shop |
\dt | List tables in the current database | SHOW TABLES |
\d orders | Describe a table: columns, indexes, foreign keys | DESCRIBE orders / SHOW CREATE TABLE |
\du | List roles (users) | SELECT user, host FROM mysql.user |
\x | Toggle expanded output (one column per line) | end a statement with \G |
\timing | Show how long each statement took | shown after every statement by default |
\i C:/path/file.sql | Run a file | source C:/path/file.sql |
\q | Quit | exit |
psql -U postgres -d shop
\dt
\d orders
SELECT id, customer_id, status, total FROM orders WHERE customer_id IS NULL;
\q
Three Windows details, because Linux advice will mislead you. There is no postgres operating-system user (the service runs as Network Service), so you always run psql -U postgres with a password. A plain console prints a code-page warning, so run chcp 1252 first. And psql connects over TCP to localhost, so only the host ... 127.0.0.1/32 and ::1/128 lines of pg_hba.conf matter locally.
Connecting: the five things every client asks for
Every dialog and command line asks the same five questions, as flags or packed into one URI. MySQL adds a twist: an account is a user and a host pattern, so 'app'@'localhost' and 'app'@'%' are two different accounts. Chapter 14 covers that and connecting from another machine.
| What it asks | MySQL | PostgreSQL |
|---|---|---|
| Host | localhost or 127.0.0.1 for your own machine | |
| Port | 3306 (X Protocol 33060) | 5432 |
| User | user plus host pattern | a role |
| Database to land in | a database is called a schema | databases contain schemas (chapter 17) |
| SSL/TLS | --ssl-mode=REQUIRED; 8.4 generates its own certificates at first start | sslmode=require |
| Saved password | .mylogin.cnf in %APPDATA%\MySQL | pgpass.conf in %APPDATA%\postgresql |
# Flags, then a URI. Both clients fall back to plain text unless you require TLS.
mysql -h 127.0.0.1 -P 3306 -u app -p --ssl-mode=REQUIRED shop
mysqlsh app@db01.example.internal:3306/shop
mysql_config_editor set --login-path=local --host=localhost --user=root --password
# psql: lowercase -p is the port, -U is the user
psql -h 127.0.0.1 -p 5432 -U app -d shop
psql "postgresql://app@db01.example.internal:5432/shop?sslmode=require"
Grids run real SQL: editing a cell and clicking Apply sends an UPDATE that autocommit commits on the spot (chapter 9). Browse production with a read-only account, and give that connection its own color.
For you as a DBA
Half of "the database is down" tickets are one of these five facts being wrong: a changed port, an account created for localhost used from a web server, a missing firewall rule, or an old driver that only knows the removed mysql_native_password plugin. Get the exact error text first; it usually names which one.
Sample databases worth loading
An empty server teaches nothing. Load shop first, and a bigger one when you want to feel what an index does on a million rows.
| Database | Engine | What is in it | Get it |
|---|---|---|---|
shop | Both | Customers, products, orders, order items, and a small tracks table of album tracks. The course dataset. | assets/sample-shop.mysql.sql, assets/sample-shop.postgres.sql |
sakila | MySQL | A DVD rental store: 16 tables, views, stored procedures, triggers. The Configurator can install it for you. | sakila-db.zip |
world | MySQL | Countries, cities and languages in three tables. Small and quick. | world-db.zip |
employees | MySQL | About 300,000 employees and 2.8 million salary rows. Big enough that a missing index hurts. | github.com/datacharmer/test_db |
pagila | PostgreSQL | A port of sakila to PostgreSQL, with full-text search and JSONB variants. | github.com/devrimgunduz/pagila |
dvdrental | PostgreSQL | Another DVD store: 15 tables, 7 views, 8 functions, 1 trigger. A pg_dump archive, so you restore it. | dvdrental.zip |
chinook | Both | A digital media store (artists, albums, tracks, invoices). One script per engine. | Chinook release assets |
The full MySQL list, including the 625 MB airportdb, is at dev.mysql.com/doc/index-other.html. Each sample creates its own database; sakila comes as two files, and employees must be run from inside its unzipped folder, because it pulls in data files by relative path.
# MySQL. The course dataset creates database "shop".
cmd.exe /c "mysql -u root -p < assets\sample-shop.mysql.sql"
cmd.exe /c "mysql -u root -p < sakila-schema.sql"
cmd.exe /c "mysql -u root -p < sakila-data.sql"
cmd.exe /c "mysql -u root -p < employees.sql"
# PostgreSQL. shop and Chinook create their own database, so no -d.
psql -U postgres -f assets/sample-shop.postgres.sql
psql -U postgres -c "CREATE DATABASE pagila"
psql -U postgres -d pagila -f pagila-schema.sql
psql -U postgres -d pagila -f pagila-data.sql
# dvdrental is a pg_dump archive, so pg_restore, not psql
psql -U postgres -c "CREATE DATABASE dvdrental"
pg_restore -U postgres -d dvdrental C:\samples\dvdrental.tar
Ask the AI
You do not need to remember dump options: "MySQL 8.4 on Windows 11: give me the exact mysqlsh commands to dump only the shop schema to C:\backups with 4 threads, then load it into a fresh 8.4 server, including any server setting the load needs."
Throwaway instances: Docker and online sandboxes
Your installed server is where you practice DBA work. Sometimes you want a second one to test a restore, run 9.7 next to 8.4, or break something on purpose.
# MySQL 8.4 LTS on host port 3307 (tags mysql:9.7 and mysql:26.7 also exist)
docker run --name mysql84 -e MYSQL_ROOT_PASSWORD=ChangeMe1 -p 3307:3306 -d mysql:8.4
mysql -h 127.0.0.1 -P 3307 -u root -p
# PostgreSQL 18 on host port 5433 (postgres:17 for the older major)
docker run --name pg18 -e POSTGRES_PASSWORD=ChangeMe1 -p 5433:5432 -d postgres:18
psql -h 127.0.0.1 -p 5433 -U postgres
# Done experimenting? This deletes the containers and their data.
docker rm -f mysql84 pg18
Docker Desktop uses WSL 2 under the hood. Map the container port to a spare host port if your real service owns 3306 or 5432, then connect with your normal client. Oracle builds its MySQL images for Linux and calls running them elsewhere "at your own risk", fine for a learning instance. Image pages: hub.docker.com/_/mysql and hub.docker.com/_/postgres.
Browser sandboxes answer "does this syntax work in 8.4?" without installing anything. They are query-only, and none runs the 26.x line yet, so treat them as scratch paper; chapter 18 has the gamified practice sites.
| Sandbox | What it runs |
|---|---|
| db<>fiddle | MySQL 5.5 through 9.7 and PostgreSQL 8.4 through 18. The best place to compare versions. |
| DB Fiddle | A different site: MySQL 9.5 and 8.4, PostgreSQL, MariaDB, SQLite. Shareable links. |
| SQLize.online | MySQL 8.0, 8.4 and 9.7 plus PostgreSQL 15 to 18. Its Sakila variant is MySQL 8.0 and read-only. |
| SQLite Online | Despite the name, also MySQL/MariaDB and PostgreSQL. Not for personal data, as its own terms say. |
| OneCompiler MySQL, Codapi MySQL | Minimal editors, no account, fine for a five-line experiment. |
| SQL Fiddle, RunSQL | MySQL, PostgreSQL and SQL Server; RunSQL adds a visual schema builder. |
| phpMyAdmin demo | Log in as root with an empty password to relearn the web GUI many hosting panels still use. Resets every hour. |
Skip W3Schools' "MySQL Tryit": it is not a MySQL server, and modern browsers only give it a read-only fallback.
Which tool when
| Task | MySQL | PostgreSQL |
|---|---|---|
| Ad-hoc query | mysql or MySQL Shell for a fact; Workbench, HeidiSQL or DBeaver to look at results | psql for a fact; pgAdmin Query Tool or DBeaver to look at results |
| Browse a schema you did not design | Workbench, DBeaver (ER diagram), HeidiSQL | pgAdmin object browser, DBeaver, \d in psql |
| Backup and restore | MySQL Shell util.dumpInstance() / util.loadDump(); mysqldump for small or plain-SQL dumps; binary log for point in time | pg_dump / pg_restore, pg_basebackup; pgAdmin's Backup dialog runs them for you |
| Users and grants | CREATE USER / GRANT in any client; Workbench administration pages | CREATE ROLE / GRANT in psql; pgAdmin role dialogs; pg_hba.conf for who may connect |
| Monitoring | Performance Schema and sys views, SHOW PROCESSLIST; Workbench status page; PMM or Grafana for dashboards | pg_stat_activity, pg_stat_statements; pgAdmin dashboard; PMM |
| Scripting and automation | mysql -e or a .sql file from Task Scheduler, credentials via --login-path; mysqlsh with JavaScript or Python for logic | psql -f or -c from Task Scheduler, password from pgpass.conf; PowerShell around it |
| Upgrade readiness | mysqlsh util.checkForServerUpgrade() | pg_upgrade --check |
| Copy data between the two engines | DBeaver's data transfer wizard, in either direction | |
If a task is not in this table, it is still SQL or a command-line utility, so ask: "MySQL 9.7 on Windows 11, which tool and which exact command does this?"