标签:
http://blog.csdn.net/linwaterbin/article/category/1299332
mysqldump -S /tmp/mysql.sock --single-transaction --force --databases test > v1.sql
[root@localhost data]# cat v1.sql -- MySQL dump 10.13 Distrib 5.6.28, for Linux (x86_64) -- -- Host: localhost Database: test -- ------------------------------------------------------ -- Server version 5.6.28-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE=‘+00:00‘ */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=‘NO_AUTO_VALUE_ON_ZERO‘ */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Current Database: `test` -- CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; USE `test`; -- -- Table structure for table `user` -- DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user` ( `id` varchar(20) NOT NULL, `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user` -- LOCK TABLES `user` WRITE; /*!40000 ALTER TABLE `user` DISABLE KEYS */; INSERT INTO `user` VALUES (‘1‘,‘Michael‘); /*!40000 ALTER TABLE `user` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2016-07-08 6:12:19
general_log:生成的日志
[root@localhost data]# cat localhost.log mysqld, Version: 5.6.28-debug-log (Source distribution). started with: Tcp port: 3306 Unix socket: /tmp/mysql.sock Time Id Command Argument 160708 6:12:18 8 Connect root@localhost on 8 Query /*!40100 SET @@SQL_MODE=‘‘ */ 8 Query /*!40103 SET TIME_ZONE=‘+00:00‘ */ 8 Query SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ RR级别 8 Query START TRANSACTION /*!40100 WITH CONSISTENT SNAPSHOT */ 开始一个事务 8 Query SHOW VARIABLES LIKE ‘gtid\_mode‘ 8 Query UNLOCK TABLES 8 Query SELECT LOGFILE_GROUP_NAME, FILE_NAME, TOTAL_EXTENTS, INITIAL_SIZE, ENGINE, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = ‘UNDO LOG‘ AND FILE_NAME IS NOT NULL AND LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = ‘DATAFILE‘ AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN (‘test‘))) GROUP BY LOGFILE_GROUP_NAME, FILE_NAME, ENGINE ORDER BY LOGFILE_GROUP_NAME 8 Query SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = ‘DATAFILE‘ AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN (‘test‘)) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME 8 Query SHOW VARIABLES LIKE ‘ndbinfo\_version‘ 8 Init DB test 8 Query SHOW CREATE DATABASE IF NOT EXISTS `test` 8 Query SAVEPOINT sp // save sp 8 Query show tables 8 Query show table status like ‘user‘ 8 Query SET SQL_QUOTE_SHOW_CREATE=1 8 Query SET SESSION character_set_results = ‘binary‘ 8 Query show create table `user` 8 Query SET SESSION character_set_results = ‘utf8‘ 8 Query show fields from `user` 8 Query SELECT /*!40001 SQL_NO_CACHE */ * FROM `user` 8 Query SET SESSION character_set_results = ‘binary‘ 8 Query use `test` 8 Query select @@collation_database 8 Query SHOW TRIGGERS LIKE ‘user‘ 8 Query SET SESSION character_set_results = ‘utf8‘ 8 Query ROLLBACK TO SAVEPOINT sp 8 Query RELEASE SAVEPOINT sp 160708 6:12:19 8 Quit
标签:
原文地址:http://www.cnblogs.com/zengkefu/p/5654637.html