mysqldump跟蹤匯出來東西是否排序了

bulletming發表於2019-05-22

開啟Mysql的日誌跟蹤一下,以確認mysqldump出來的rows是否會排序,以排除根據dump出結果計算md5然後對比兩張表內容的方法。

使用-T也不會排序的


dump出來的內容:

F:mysqlmysqltoolkit-1254bin>mysqldump -uroot -proot test
-- MySQL dump 10.11
--
-- Host: localhost Database: test
-- ------------------------------------------------------
-- Server version 5.0.45-community-nt-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 */;

--
-- Table structure for table `a`
--

DROP TABLE IF EXISTS `a`;
CREATE TABLE `a` (
`a` int(11) default NULL,
`b` int(11) default NULL,
`c` int(11) default NULL,
`d` varchar(200) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `a`
--

LOCK TABLES `a` WRITE;
/*!40000 ALTER TABLE `a` DISABLE KEYS */;
INSERT INTO `a` VALUES (1,2,3,'6'),(2,NULL,4,'6'),(3,4,5,'6');
/*!40000 ALTER TABLE `a` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `b`
--

DROP TABLE IF EXISTS `b`;
CREATE TABLE `b` (
`a` int(11) default NULL,
`b` int(11) default NULL,
`c` int(11) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `b`
--

LOCK TABLES `b` WRITE;
/*!40000 ALTER TABLE `b` DISABLE KEYS */;
INSERT INTO `b` VALUES (1,2,4),(2,3,4),(3,4,5);
/*!40000 ALTER TABLE `b` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `c`
--

DROP TABLE IF EXISTS `c`;
CREATE TABLE `c` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `c`
--

LOCK TABLES `c` WRITE;
/*!40000 ALTER TABLE `c` DISABLE KEYS */;
INSERT INTO `c` VALUES (1,2,3),(2,NULL,4),(3,4,5);
/*!40000 ALTER TABLE `c` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET */;

/*!40101 SET */;
/*!40014 SET */;
/*!40014 SET */;
/*!40101 SET */;
/*!40101 SET */;
/*!40101 SET */;
/*!40111 SET */;

-- Dump completed on 2007-11-17 19:28:14

F:mysqlmysqltoolkit-1254bin>

對應mysqllog中記錄的日誌:

071118 3:28:14 71 Connect on
71 Query /*!40100 SET @@SQL_MODE='' */
71 Query /*!40103 SET TIME_ZONE='+00:00' */
71 Init DB test
71 Query show tables
71 Query LOCK TABLES `a` READ /*!32311 LOCAL */,`b` READ /*!32311 LOCAL */,`c` READ /*!32311 LOCAL */
71 Query show table status like 'a'
71 Query SET OPTION SQL_QUOTE_SHOW_CREATE=1
71 Query show create table `a`
71 Query show fields from `a`
71 Query SELECT /*!40001 SQL_NO_CACHE */ * FROM `a`
71 Query SHOW TRIGGERS LIKE 'a'
71 Query show table status like 'b'
71 Query SET OPTION SQL_QUOTE_SHOW_CREATE=1
71 Query show create table `b`
71 Query show fields from `b`
71 Query SELECT /*!40001 SQL_NO_CACHE */ * FROM `b`
71 Query SHOW TRIGGERS LIKE 'b'
71 Query show table status like 'c'
71 Query SET OPTION SQL_QUOTE_SHOW_CREATE=1
71 Query show create table `c`
71 Query show fields from `c`
71 Query SELECT /*!40001 SQL_NO_CACHE */ * FROM `c`
71 Query SHOW TRIGGERS LIKE 'c'
71 Query UNLOCK TABLES
71 Quit

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/82392/viewspace-144728/,如需轉載,請註明出處,否則將追究法律責任。

相關文章