Skip to content
Home
Dev Convert Generate Finance Calc Design Security Media

More categories

Productivity 23 Network Tools 18 Text Tools 16 SEO Tools 15 Education Tools 14 PDF Tools 10 Mockups 5

Learn and build

GuidesBlogAPI & MCPCheatsheetsChangelog All categories

Browse

401 tools · 15 categories

Start here

Popular tools New this week 18 All tools 401

Categories

Developer Tools 92 Converters 49 Finance Tools 31 Generators 31 Calculators 26 Design Tools 25 Media Tools 23 Productivity 23 Security Tools 23 Network Tools 18 Text Tools 16 SEO Tools 15 Education Tools 14 PDF Tools 10 Mockups 5

Learn and build

Guides Cheatsheets Blog REST API MCP server Changelog

No matches here.

Keep FindUtils free Sponsors fund new tools
  1. Cheatsheets
Guides Blog API & MCP
Sponsor
FindUtils
Sponsor
  1. Home
  2. Cheatsheets
  3. Programming
  4. MySQL Reference

Programming · Cheatsheet

MySQL Reference Cheatsheet

MySQL queries, joins, indexes, user management, and database administration

64 commands 9 sections

On this sheet

Connection & Basics 10 Database & Table Management 9 SELECT Queries 9 INSERT, UPDATE & DELETE 8 JOINs 6 Aggregation & Grouping 6 Indexes & Performance 8 User & Access Management 7 Sources 1
Try it in the browser Turn a CSV into CREATE TABLE and INSERT statements for Postgres, MySQL, or SQLite. Open CSV to SQL

No entry matches that filter.

Connection & Basics

  • mysql -u root -p Connect to MySQL as root
  • mysql -h host -u user -p dbname Connect to remote database
  • mysql -u user -p < dump.sql Import SQL file
  • mysqldump -u user -p dbname > dump.sql Export database to SQL file
  • mysqldump -u user -p --all-databases > all.sql Export all databases
  • SHOW DATABASES; List all databases
  • USE database_name; Switch to a database
  • SHOW TABLES; List tables in current database
  • DESCRIBE table_name; Show table structure and columns
  • SHOW CREATE TABLE table_name; Show table creation SQL

Database & Table Management

  • CREATE DATABASE dbname CHARACTER SET utf8mb4; Create database with UTF-8 support
  • DROP DATABASE dbname; Delete a database
  • CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255)); Create a table
  • DROP TABLE table_name; Delete a table
  • TRUNCATE TABLE table_name; Delete all rows (faster than DELETE)
  • RENAME TABLE old_name TO new_name; Rename a table
  • ALTER TABLE users ADD email VARCHAR(255) AFTER name; Add column after specific column
  • ALTER TABLE users DROP COLUMN email; Remove a column
  • ALTER TABLE users MODIFY name VARCHAR(500); Change column type

SELECT Queries

  • SELECT * FROM users; Select all columns and rows
  • SELECT name, email FROM users WHERE id = 1; Select specific columns with filter
  • SELECT DISTINCT status FROM orders; Select unique values only
  • SELECT * FROM users ORDER BY created_at DESC; Sort results descending
  • SELECT * FROM users LIMIT 10 OFFSET 20; Paginate results (page 3)
  • SELECT * FROM users WHERE name LIKE "%john%"; Pattern matching search
  • SELECT * FROM users WHERE id IN (1, 2, 3); Filter by list of values
  • SELECT * FROM users WHERE age BETWEEN 18 AND 30; Filter by range
  • SELECT * FROM users WHERE email IS NOT NULL; Filter for non-null values

INSERT, UPDATE & DELETE

  • INSERT INTO users (name, email) VALUES ('Alice', '[email protected]'); Insert a single row
  • INSERT INTO users (name) VALUES ('A'), ('B'), ('C'); Insert multiple rows
  • INSERT INTO target SELECT * FROM source; Insert from another table
  • UPDATE users SET name = 'Bob' WHERE id = 1; Update specific rows
  • UPDATE users SET status = "active" WHERE last_login > NOW() - INTERVAL 30 DAY; Update with date condition
  • DELETE FROM users WHERE id = 1; Delete specific rows
  • DELETE FROM logs WHERE created_at < "2025-01-01"; Delete old records
  • INSERT INTO ... ON DUPLICATE KEY UPDATE name = VALUES(name); Upsert (insert or update)

JOINs

  • SELECT * FROM orders INNER JOIN users ON orders.user_id = users.id; Inner join (matching rows only)
  • SELECT * FROM users LEFT JOIN orders ON users.id = orders.user_id; Left join (all from left table)
  • SELECT * FROM orders RIGHT JOIN users ON orders.user_id = users.id; Right join (all from right table)
  • SELECT * FROM t1 CROSS JOIN t2; Cross join (cartesian product)
  • SELECT * FROM users u JOIN orders o ON u.id = o.user_id JOIN items i ON o.id = i.order_id; Multi-table join
  • SELECT * FROM employees e JOIN employees m ON e.manager_id = m.id; Self join

Aggregation & Grouping

  • SELECT COUNT(*) FROM users; Count all rows
  • SELECT status, COUNT(*) FROM users GROUP BY status; Count by group
  • SELECT AVG(price), SUM(price) FROM orders; Average and sum
  • SELECT MAX(salary), MIN(salary) FROM employees; Max and min values
  • SELECT status, COUNT(*) FROM orders GROUP BY status HAVING COUNT(*) > 10; Filter groups with HAVING
  • SELECT YEAR(created_at), COUNT(*) FROM users GROUP BY YEAR(created_at); Group by date part

Indexes & Performance

  • CREATE INDEX idx_email ON users(email); Create an index on column
  • CREATE UNIQUE INDEX idx_email ON users(email); Create unique index
  • CREATE INDEX idx_name_email ON users(name, email); Create composite index
  • DROP INDEX idx_email ON users; Delete an index
  • SHOW INDEX FROM users; List indexes on a table
  • EXPLAIN SELECT * FROM users WHERE email = "[email protected]"; Analyze query execution plan
  • EXPLAIN ANALYZE SELECT * FROM users; Execute and show actual timing
  • SHOW PROCESSLIST; Show active queries and connections

User & Access Management

  • CREATE USER 'app'@'%' IDENTIFIED BY 'pass'; Create user with password
  • GRANT ALL ON dbname.* TO 'app'@'%'; Grant all privileges on database
  • GRANT SELECT, INSERT ON dbname.* TO 'reader'@'%'; Grant specific privileges
  • REVOKE ALL ON dbname.* FROM 'app'@'%'; Revoke all privileges
  • DROP USER 'app'@'%'; Delete a user
  • FLUSH PRIVILEGES; Reload privilege tables
  • SHOW GRANTS FOR 'app'@'%'; Show user privileges

Sources

  • https://dev.mysql.com/doc/refman/8.4/en/ MySQL 8.4 manual: SQL syntax, indexes, accounts, and administration.

Related cheatsheets

  • Barcode Formats40 commands
  • JavaScript ES6+59 commands
  • Python Essentials59 commands

Guides that use these commands

  • Convert a SQL Dump to CSV Without Restoring a DatabaseGuide · 7 min read
  • Convert JSON to SQL INSERT Statements Without Losing TypesGuide · 6 min read
  • Convert CSV to SQL for PostgreSQL, MySQL, and SQLiteGuide · 7 min read

Tools for this work

  • CSV to SQLTurn a CSV into CREATE TABLE and INSERT statements for Postgres, MySQL, or SQLite.
  • JSON to SQLTurn a JSON array into CREATE TABLE and INSERT statements. Booleans and null survive.
  • SQL to CSVPaste a .sql dump and get a CSV per table. No database to restore.

From FindUtils

More to explore

Products and services from the team behind FindUtils.

Promote your tool
Featured product seeranks.com SeeRanks — transparent product discovery A public ranking board where paid placement is always labeled and every product keeps its earned position. View SeeRanks Public rank board #1 Sponsored #2 #3 #4 Paid placement is always labeled Free favicon tool emojifavicons.com Emoji Favicons Turn any emoji into a favicon with one HTML line. SVG, PNG or ICO, no sign-up. <link rel="icon" href=".../🦊.svg"> Create a favicon
FindUtils service findutils.com Articles for software tools A sourced article for your channels, or a sponsored FindUtils publication with editorial review. Compare packages Domain portfolio findutils.com Domain names for sale .com.dev.sh.app.io Unused names across dev tools, AI, PDF and commerce. Make an offer. Browse the list Playable ranking towerscore.io TowerScore — stack the skyline Play to climb, or buy a floor. Paid floors are labeled. Open TowerScore

Missing a tool you need?

Tell us what to build next. Most requests ship as a free browser tool, an API endpoint and an MCP tool.

Request a tool
FindUtils

Free, fast utilities that respect your data. Most tools process your files in the browser, so they never leave your device.

  • No sign-up for free tools
  • Most tools run in your browser
  • 349 tools on the REST API and MCP

Tools

DevelopersConvertPDFDesignSecurityAll tools →

Learn

GuidesBlogCheatsheetsChangelog

Build

REST APIMCP serverAPI referenceWorkflowsStatus

FindUtils

AboutLibraries we useSponsorRequest a toolDomains for saleContact
© 2026 FindUtils PrivacyTermsSitemap
Service status
FindUtils

Free, fast utilities that respect your data. Most tools run in your browser.

Build with it

REST APIMCP serverGuidesChangelog

FindUtils

AboutSponsorPrivacyContact
Theme
© 2026 FindUtils Terms
FindUtils
Guides Blog REST API MCP server Changelog

Categories

Developers 92 Convert 49 Finance 31 Generate 31 Calculate 26 Design 25
All 15 categories →

Keep it free

Sponsorship keeps every tool free and funds the new ones we ship each week.

Sponsor Back the project
Tools API Sponsor