MySQL Workbench Overview
In this page:
What is MySQL Workbench?
MySQL Workbench is the official GUI client: it wraps raw SQL in visual tools for writing queries, designing schemas, and administering servers, which is friendlier for beginners than memorizing every command-line flag.
Example: What is MySQL Workbench?
-- Workbench wraps this same SQL in a visual query editor
SELECT * FROM information_schema.tables;
Connecting to a Database
Creating a connection means entering the server's hostname, port (3306 by default), and your username/password once, then saving it so future sessions are a single click instead of retyping credentials each time.
Example: Connecting to a Database
-- Connection details: host=localhost, port=3306, user=root
SELECT 1;
The Query Tab
The Query Tab is where you actually write and run SQL by hand; clicking the lightning-bolt icon executes the statement under your cursor, and results appear in a scrollable grid below, much like a spreadsheet.
Example: The Query Tab
SELECT 1; -- run with the lightning-bolt icon in the Query Tab; results appear in a grid below
Visual Database Design
Workbench's Entity-Relationship (ER) diagrams let you drag out tables and draw foreign-key lines between them, which is often easier for spotting a broken relationship than reading raw CREATE TABLE statements.
Example: Visual Database Design
CREATE TABLE customers (id INT PRIMARY KEY);
CREATE TABLE orders (
id INT PRIMARY KEY,
customer_id INT,
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
Exporting and Importing Data
Exporting to CSV or a .sql dump file is the standard way to move data between machines or share a snapshot of your schema with a teammate, and importing reverses that process to restore or seed a database.
Example: Exporting and Importing Data
-- Table Data Export/Import Wizard exports to CSV or a .sql dump
SELECT * FROM customers;
Chapter Quiz — Complete all 8 topics to unlock
0/8 topics done
Complete these topics first: