SlideShare a Scribd company logo
1 of 1
Download to read offline
MySQL Cheat Sheet.EN                                                newest original japanese sheet available at: http://bit.ly/73I1bQ | MySQL Official Document: http://dev.mysql.com/doc

               Use my.cnf for instance settings                       you can choose different
                                                                                                     Table Ops                     Command
                                                                    storage engine for each table
  connection                                                                                         List existing tables          mysql> SHOW [FULL] TABLES;
                                                  .......
   threads                                                                 Storage Engine
                                                                                                     Show table information        mysql> SHOW TABLE STATUS [LIKE 'table1'];
 Query cache Optimizer Thread Cache Binary Log
                                                                                                                                   mysql> DESC table1;
                                                                                             ...     Check table properties
                                                                                                                                   mysql> SHOW CREATE TABLE table1 G
 db1                                    db2                         Buffer Pool
                                                                                         BG                                        mysql> CREATE TABLE table1 [columns...]
  table1     table2   table3     ...     table1      table2   ...                      threads       Create table
                                                                      Disk I/O                                                     ENGINE=desired storage engine
                                                                                                     Modify table properties       mysql> ALTER TABLE table1 ...
                                                                      Data File      Log File        Transaction Ops               Command
       Storage             Storage                 Storage
           Engine              Engine              Engine                                            Switch off auto commit        mysql> SET AUTOCOMMIT=0;
                                                                                                                                   mysql> START TRANSACTION;
                                                                                                     Start a transaction
Basic Ops                               Command                                                                                    mysql> BEGIN;
                                        shell> mysql --version                                       Execute SQL statement mysql> SELECT ... (any SQL statement)
Check mysqld version
                                        mysql> SELECT VERSION;                                       Commit                        mysql> COMMIT;
Check set values                        shell> my_print_default_mysqld                               Place a save point            mysql> SAVEPOINT name of save point;
Show compile options                    shell> mysqlbug                                              Rollback                      mysql> ROLLBACK;
Connect to MySQL server                 shell> mysql -u user -p db1                                  Admin Ops                     Command
Instance Level Ops                      Command                                                      Export to a file               mysql> SELECT ... INTO OUTFILE 'file name';
                                        shell> mysqld_safe &                                                                       mysql> SET @@character_set_database=binary;
Start mysqld                            shell> sudo /etc/init.d/mysqld start                         Read from a file               mysql> LOAD DATA INFILE 'file name' INTO
                                        shell> service mysqld start                                                                TABLE 'table name';
                                        shell> mysqladmin -uroot -p shutdown                                                       mysql> mysqldump [options] -B db1,db2 >
Stop mysqld                             shell> sudo /etc/init.d/mysqld stop                                                        dump.sql
                                        shell> service mysqld stop                                   Backup                        --single-transactions (snapshot using MVCC)
                                                                                                                                   --master-data=2 (output position of binary log)
                                        shell> mysqladmin -u root -p status
Check status                                                                                                                       --flush-logs (switch binary logs)
                                        mysql> s
                                                                                                     Restore                       mysql> mysql db1 < dump.sql
Show system variables                   mysql> SHOW GLOBAL VARIABLES;
                                                                                                     Defrag                        mysql> OPTIMIZE TABLE table1;
Show status variables                   mysql> SHOW GLOBAL STATUS;
                                                                                                     Update Statistics Info        mysql> ANALYZE TABLE table1;
List connected clients                  mysql> SHOW [FULL] PROCESSLIST;
                                                                                                     Switch logs                   mysql> FLUSH LOGS;
Database Ops                            Command
                                                                                                     Export table                  mysql> FLUSH TABLES [WITH READ LOCK];
List existing databases                 mysql> SHOW DATABASES;
Create a database                       mysql> CREATE DATABASE db1;                                 This work builds upon "MySQL Cheat Sheet" (http://bit.ly/73I1bQ) BY Mikiya Okuno, 2009,
                                                                                                    and is licensed under a Creative Commons: Attribution-ShareAlike liecense.
Switch database to use                  mysql> USE db1;                                             Translated to English by Dominick Chen, 2010.

More Related Content

What's hot

RxJS Operators - Real World Use Cases (FULL VERSION)
RxJS Operators - Real World Use Cases (FULL VERSION)RxJS Operators - Real World Use Cases (FULL VERSION)
RxJS Operators - Real World Use Cases (FULL VERSION)Tracy Lee
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring SecurityDzmitry Naskou
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8LivePerson
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux ContainersJignesh Shah
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Scott Wlaschin
 
Controlling User Access -Data base
Controlling User Access -Data baseControlling User Access -Data base
Controlling User Access -Data baseSalman Memon
 
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...Edureka!
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with MockitoRichard Paul
 
Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and TomorrowVMware Tanzu
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1Shahzad
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API07.pallav
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot ApplicationsVMware Tanzu
 
React + Redux. Best practices
React + Redux.  Best practicesReact + Redux.  Best practices
React + Redux. Best practicesClickky
 

What's hot (20)

Indexes in postgres
Indexes in postgresIndexes in postgres
Indexes in postgres
 
RxJS Operators - Real World Use Cases (FULL VERSION)
RxJS Operators - Real World Use Cases (FULL VERSION)RxJS Operators - Real World Use Cases (FULL VERSION)
RxJS Operators - Real World Use Cases (FULL VERSION)
 
ProxySQL at Scale on AWS.pdf
ProxySQL at Scale on AWS.pdfProxySQL at Scale on AWS.pdf
ProxySQL at Scale on AWS.pdf
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
 
Controlling User Access -Data base
Controlling User Access -Data baseControlling User Access -Data base
Controlling User Access -Data base
 
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
 
React Hooks
React HooksReact Hooks
React Hooks
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
 
Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and Tomorrow
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot Applications
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
React + Redux. Best practices
React + Redux.  Best practicesReact + Redux.  Best practices
React + Redux. Best practices
 
Java 8 Lambda and Streams
Java 8 Lambda and StreamsJava 8 Lambda and Streams
Java 8 Lambda and Streams
 

Viewers also liked

Python3 cheatsheet
Python3 cheatsheetPython3 cheatsheet
Python3 cheatsheetGil Cohen
 
Design trends - from html tables to semantic html5
Design trends - from html tables to semantic html5Design trends - from html tables to semantic html5
Design trends - from html tables to semantic html5Kevin Bruce
 
Semantic HTML5
Semantic HTML5Semantic HTML5
Semantic HTML5Terry Ryan
 
Cheat sheets for coding
Cheat sheets for codingCheat sheets for coding
Cheat sheets for codingIsaac Oteyo
 
Install Word Press with xampp
Install Word Press with xamppInstall Word Press with xampp
Install Word Press with xamppMehdi Sharifirad
 
Extending ADDM Discovery to Firewalls, Applications and Routers
Extending ADDM Discovery to Firewalls, Applications and RoutersExtending ADDM Discovery to Firewalls, Applications and Routers
Extending ADDM Discovery to Firewalls, Applications and RoutersWes Moskal-Fitzpatrick
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetAlexey Lesovsky
 
Webentwicklung mit PHP und MySQL
Webentwicklung mit PHP und MySQLWebentwicklung mit PHP und MySQL
Webentwicklung mit PHP und MySQLKerstin Puschke
 
みんなの日本語初級 2 標準問題集
みんなの日本語初級 2 標準問題集みんなの日本語初級 2 標準問題集
みんなの日本語初級 2 標準問題集Ito Ree
 
Twitter Guide Cheat Sheet
Twitter Guide Cheat SheetTwitter Guide Cheat Sheet
Twitter Guide Cheat SheetSharath g
 
Update CMDB Using Discovery Topology (BMC ADDM)
Update CMDB Using Discovery Topology (BMC ADDM) Update CMDB Using Discovery Topology (BMC ADDM)
Update CMDB Using Discovery Topology (BMC ADDM) Vyom Labs
 

Viewers also liked (20)

Ms office 2010 complete
Ms office 2010 completeMs office 2010 complete
Ms office 2010 complete
 
Python3 cheatsheet
Python3 cheatsheetPython3 cheatsheet
Python3 cheatsheet
 
HTML5 and Semantic Web
HTML5 and Semantic WebHTML5 and Semantic Web
HTML5 and Semantic Web
 
Introduction to HTML5 and CSS3
Introduction to HTML5 and CSS3Introduction to HTML5 and CSS3
Introduction to HTML5 and CSS3
 
Design trends - from html tables to semantic html5
Design trends - from html tables to semantic html5Design trends - from html tables to semantic html5
Design trends - from html tables to semantic html5
 
Java cheat sheet
Java cheat sheet Java cheat sheet
Java cheat sheet
 
Semantic HTML5
Semantic HTML5Semantic HTML5
Semantic HTML5
 
Java cheat sheet
Java cheat sheetJava cheat sheet
Java cheat sheet
 
MySQL Cheat Sheet
MySQL Cheat SheetMySQL Cheat Sheet
MySQL Cheat Sheet
 
Cheat sheets for coding
Cheat sheets for codingCheat sheets for coding
Cheat sheets for coding
 
Google Cheat Sheet
Google Cheat SheetGoogle Cheat Sheet
Google Cheat Sheet
 
Install Word Press with xampp
Install Word Press with xamppInstall Word Press with xampp
Install Word Press with xampp
 
Extending ADDM Discovery to Firewalls, Applications and Routers
Extending ADDM Discovery to Firewalls, Applications and RoutersExtending ADDM Discovery to Firewalls, Applications and Routers
Extending ADDM Discovery to Firewalls, Applications and Routers
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication Cheatsheet
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Webentwicklung mit PHP und MySQL
Webentwicklung mit PHP und MySQLWebentwicklung mit PHP und MySQL
Webentwicklung mit PHP und MySQL
 
みんなの日本語初級 2 標準問題集
みんなの日本語初級 2 標準問題集みんなの日本語初級 2 標準問題集
みんなの日本語初級 2 標準問題集
 
Twitter Guide Cheat Sheet
Twitter Guide Cheat SheetTwitter Guide Cheat Sheet
Twitter Guide Cheat Sheet
 
Update CMDB Using Discovery Topology (BMC ADDM)
Update CMDB Using Discovery Topology (BMC ADDM) Update CMDB Using Discovery Topology (BMC ADDM)
Update CMDB Using Discovery Topology (BMC ADDM)
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 

Similar to MySQL Cheat Sheet

Summary tables with flexviews
Summary tables with flexviewsSummary tables with flexviews
Summary tables with flexviewsJustin Swanhart
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & clusterelliando dias
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsMark Leith
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016Dave Stokes
 
Get mysql clusterrunning-windows
Get mysql clusterrunning-windowsGet mysql clusterrunning-windows
Get mysql clusterrunning-windowsJoeSg
 
ConFoo MySQL Replication Evolution : From Simple to Group Replication
ConFoo  MySQL Replication Evolution : From Simple to Group ReplicationConFoo  MySQL Replication Evolution : From Simple to Group Replication
ConFoo MySQL Replication Evolution : From Simple to Group ReplicationDave Stokes
 
Explaining the MySQL Explain
Explaining the MySQL ExplainExplaining the MySQL Explain
Explaining the MySQL ExplainMYXPLAIN
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestratorYoungHeon (Roy) Kim
 
MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017Dave Stokes
 
My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)Nicholas Adu Gyamfi
 
Mysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windowsMysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windowsRogério Rocha
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016Dave Stokes
 
MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016Dave Stokes
 

Similar to MySQL Cheat Sheet (20)

MariaDB training
MariaDB trainingMariaDB training
MariaDB training
 
My sql administration
My sql administrationMy sql administration
My sql administration
 
Summary tables with flexviews
Summary tables with flexviewsSummary tables with flexviews
Summary tables with flexviews
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & cluster
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016
 
Mysql all
Mysql allMysql all
Mysql all
 
Raj mysql
Raj mysqlRaj mysql
Raj mysql
 
Get mysql clusterrunning-windows
Get mysql clusterrunning-windowsGet mysql clusterrunning-windows
Get mysql clusterrunning-windows
 
ConFoo MySQL Replication Evolution : From Simple to Group Replication
ConFoo  MySQL Replication Evolution : From Simple to Group ReplicationConFoo  MySQL Replication Evolution : From Simple to Group Replication
ConFoo MySQL Replication Evolution : From Simple to Group Replication
 
Explaining the MySQL Explain
Explaining the MySQL ExplainExplaining the MySQL Explain
Explaining the MySQL Explain
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017MySQL Replication Evolution -- Confoo Montreal 2017
MySQL Replication Evolution -- Confoo Montreal 2017
 
My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)
 
Mysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windowsMysql wp cluster_quickstart_windows
Mysql wp cluster_quickstart_windows
 
Mysql all
Mysql allMysql all
Mysql all
 
Mysql
MysqlMysql
Mysql
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016
 
MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016
 
java
javajava
java
 

More from Chen Dominique

Cybernetic Serendipity, reloaded
Cybernetic Serendipity, reloadedCybernetic Serendipity, reloaded
Cybernetic Serendipity, reloadedChen Dominique
 
コミュニティとしてのオープンプロダクトの展開
コミュニティとしてのオープンプロダクトの展開コミュニティとしてのオープンプロダクトの展開
コミュニティとしてのオープンプロダクトの展開Chen Dominique
 
Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...
Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...
Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...Chen Dominique
 
Free Hardware and Open Processes | フリー・ハードウェアとオープン・プロセス
Free Hardware and Open Processes | フリー・ハードウェアとオープン・プロセスFree Hardware and Open Processes | フリー・ハードウェアとオープン・プロセス
Free Hardware and Open Processes | フリー・ハードウェアとオープン・プロセスChen Dominique
 
Power Of Open and Beyond / オープンネスの先にあるもの
Power Of Open and Beyond / オープンネスの先にあるものPower Of Open and Beyond / オープンネスの先にあるもの
Power Of Open and Beyond / オープンネスの先にあるものChen Dominique
 

More from Chen Dominique (8)

Ncc day2 talk
Ncc day2 talkNcc day2 talk
Ncc day2 talk
 
Cybernetic Serendipity, reloaded
Cybernetic Serendipity, reloadedCybernetic Serendipity, reloaded
Cybernetic Serendipity, reloaded
 
コミュニティとしてのオープンプロダクトの展開
コミュニティとしてのオープンプロダクトの展開コミュニティとしてのオープンプロダクトの展開
コミュニティとしてのオープンプロダクトの展開
 
TEDxKids@Chiyoda 2012
TEDxKids@Chiyoda 2012TEDxKids@Chiyoda 2012
TEDxKids@Chiyoda 2012
 
"FabLife"を読む
"FabLife"を読む"FabLife"を読む
"FabLife"を読む
 
Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...
Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...
Communication Design for creating Creative Circulation | 創造の循環を生むためのコミュニケーション...
 
Free Hardware and Open Processes | フリー・ハードウェアとオープン・プロセス
Free Hardware and Open Processes | フリー・ハードウェアとオープン・プロセスFree Hardware and Open Processes | フリー・ハードウェアとオープン・プロセス
Free Hardware and Open Processes | フリー・ハードウェアとオープン・プロセス
 
Power Of Open and Beyond / オープンネスの先にあるもの
Power Of Open and Beyond / オープンネスの先にあるものPower Of Open and Beyond / オープンネスの先にあるもの
Power Of Open and Beyond / オープンネスの先にあるもの
 

MySQL Cheat Sheet

  • 1. MySQL Cheat Sheet.EN newest original japanese sheet available at: http://bit.ly/73I1bQ | MySQL Official Document: http://dev.mysql.com/doc Use my.cnf for instance settings you can choose different Table Ops Command storage engine for each table connection List existing tables mysql> SHOW [FULL] TABLES; ....... threads Storage Engine Show table information mysql> SHOW TABLE STATUS [LIKE 'table1']; Query cache Optimizer Thread Cache Binary Log mysql> DESC table1; ... Check table properties mysql> SHOW CREATE TABLE table1 G db1 db2 Buffer Pool BG mysql> CREATE TABLE table1 [columns...] table1 table2 table3 ... table1 table2 ... threads Create table Disk I/O ENGINE=desired storage engine Modify table properties mysql> ALTER TABLE table1 ... Data File Log File Transaction Ops Command Storage Storage Storage Engine Engine Engine Switch off auto commit mysql> SET AUTOCOMMIT=0; mysql> START TRANSACTION; Start a transaction Basic Ops Command mysql> BEGIN; shell> mysql --version Execute SQL statement mysql> SELECT ... (any SQL statement) Check mysqld version mysql> SELECT VERSION; Commit mysql> COMMIT; Check set values shell> my_print_default_mysqld Place a save point mysql> SAVEPOINT name of save point; Show compile options shell> mysqlbug Rollback mysql> ROLLBACK; Connect to MySQL server shell> mysql -u user -p db1 Admin Ops Command Instance Level Ops Command Export to a file mysql> SELECT ... INTO OUTFILE 'file name'; shell> mysqld_safe & mysql> SET @@character_set_database=binary; Start mysqld shell> sudo /etc/init.d/mysqld start Read from a file mysql> LOAD DATA INFILE 'file name' INTO shell> service mysqld start TABLE 'table name'; shell> mysqladmin -uroot -p shutdown mysql> mysqldump [options] -B db1,db2 > Stop mysqld shell> sudo /etc/init.d/mysqld stop dump.sql shell> service mysqld stop Backup --single-transactions (snapshot using MVCC) --master-data=2 (output position of binary log) shell> mysqladmin -u root -p status Check status --flush-logs (switch binary logs) mysql> s Restore mysql> mysql db1 < dump.sql Show system variables mysql> SHOW GLOBAL VARIABLES; Defrag mysql> OPTIMIZE TABLE table1; Show status variables mysql> SHOW GLOBAL STATUS; Update Statistics Info mysql> ANALYZE TABLE table1; List connected clients mysql> SHOW [FULL] PROCESSLIST; Switch logs mysql> FLUSH LOGS; Database Ops Command Export table mysql> FLUSH TABLES [WITH READ LOCK]; List existing databases mysql> SHOW DATABASES; Create a database mysql> CREATE DATABASE db1; This work builds upon "MySQL Cheat Sheet" (http://bit.ly/73I1bQ) BY Mikiya Okuno, 2009, and is licensed under a Creative Commons: Attribution-ShareAlike liecense. Switch database to use mysql> USE db1; Translated to English by Dominick Chen, 2010.