← Back to MySQL Course | Chapter 1: Introduction & Basics | Lesson 5 of 8

MySQL Workbench Overview

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?

sql
-- Workbench wraps this same SQL in a visual query editor
SELECT * FROM information_schema.tables;

⚠️ This is MySQL-specific syntax. It cannot run in the browser editor. Practice this on your local MySQL installation.

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

sql
-- 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

sql
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

sql
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

sql
-- 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:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.