MySQL Cheat Sheet
Transform, format, and optimize your data instantly with this free client-side tool.
CLI & Admin
Connect to MySQL via terminal
Connect to a remote MySQL host
Backup database to a SQL file
Restore database from a SQL file
List currently running threads/queries
Kill a specific thread by ID
Show server system variables
Databases
Create a new database
Delete a database
List all databases on the server
Select a database to use
Tables
List all tables in current database
Show table structure (columns and data types)
Create a new table
Delete a table
Empty all data from a table, reset auto increments
Add a column to an existing table
Remove a column from a table
Change column data type
Rename an existing table
CRUD
Retrieve all rows and columns
Insert a new row
Update existing rows
Delete rows matching a condition
Insert, or update if duplicate key exists
Queries
Retrieve specific columns
Retrieve only unique values
Filter with WHERE clause
Match any value in list
Pattern matching with wildcards
Sort results in descending order
Paginate (limit num rows, offset start)
Joins
Inner join (matching rows in both)
Left join (all t1, matching t2)
Right join (all t2, matching t1)
Aggregation
Count total rows
Group rows and count occurrences
Calculate sum of a numeric column
Calculate average of a numeric column
Filter grouped results with HAVING
Users & Privileges
Create a new database user
Grant all permissions on a database
Grant specific permissions globally
List assigned permissions for a user
Remove permissions
Delete a user
Reload privileges from grant tables
Performance
Create an index on a column
Create a unique index
Delete an index
Analyze query execution plan
Advanced
Explore advanced configurations for Mysql
Performance tuning best practices for Mysql
Run security checks and validation for Mysql
🔥 Similar Tools
Explore LibraryFrequently Asked Questions
Got questions? We've got answers.