KEMBAR78
Mysql Cheat Sheet en 120625000908 Phpapp02 PDF | PDF | Database Transaction | My Sql
100% found this document useful (1 vote)
2K views1 page

Mysql Cheat Sheet en 120625000908 Phpapp02 PDF

This document provides a cheat sheet for MySQL with summaries of basic operations, table operations, storage engines, transaction operations, administration operations, and more. It includes commands for connecting to MySQL, starting and stopping the MySQL daemon, checking server status, creating and modifying databases and tables, importing and exporting data, and server administration tasks like backups, restores, and log maintenance. A link is provided to the original Japanese sheet as well as the MySQL official documentation.

Uploaded by

Desislava Valova
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views1 page

Mysql Cheat Sheet en 120625000908 Phpapp02 PDF

This document provides a cheat sheet for MySQL with summaries of basic operations, table operations, storage engines, transaction operations, administration operations, and more. It includes commands for connecting to MySQL, starting and stopping the MySQL daemon, checking server status, creating and modifying databases and tables, importing and exporting data, and server administration tasks like backups, restores, and log maintenance. A link is provided to the original Japanese sheet as well as the MySQL official documentation.

Uploaded by

Desislava Valova
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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.

You might also like