MySQL 命令行工具之 mysqldump 深入研究(11)

3 Init DB gs 3 Query SHOW CREATE DATABASE IF NOT EXISTS `gs` 3 Query show tables 3 Query LOCK TABLES `tb1` READ /*!32311 LOCAL */,`user` READ /*!32311 LOCAL */ 3 Query show table status like 'tb1' 3 Query SET SQL_QUOTE_SHOW_CREATE=1 3 Query SET SESSION character_set_results = 'binary' 3 Query show create table `tb1` 3 Query SET SESSION character_set_results = 'utf8' 3 Query show fields from `tb1` 3 Query SELECT /*!40001 SQL_NO_CACHE */ * FROM `tb1` 3 Query SET SESSION character_set_results = 'binary' 3 Query use `gs` 3 Query select @@collation_database 3 Query SHOW TRIGGERS LIKE 'tb1' 3 Query SET SESSION character_set_results = 'utf8' 3 Query show table status like 'user' 3 Query SET SQL_QUOTE_SHOW_CREATE=1 3 Query SET SESSION character_set_results = 'binary' 3 Query show create table `user` 3 Query SET SESSION character_set_results = 'utf8' 3 Query show fields from `user` 3 Query SELECT /*!40001 SQL_NO_CACHE */ * FROM `user` 3 Query SET SESSION character_set_results = 'binary' 3 Query use `gs` 3 Query select @@collation_database 3 Query SHOW TRIGGERS LIKE 'user' 3 Query SET SESSION character_set_results = 'utf8' 3 Query UNLOCK TABLES 3 Quit

1> 第一步: SHOW CREATE DATABASE IF NOT EXISTS `gs`; 导出了建库语句;

2> 第二步:show tables; 获得数据库中所有表名,然后锁住:LOCK TABLES `tb1` READ /*!32311 LOCAL */,`user` READ /*!32311 LOCAL */

                使用的是 lock table tb1 read local, tb2 read local, tb3 read local; 语句

3> 第三步:show create table 'tb1'; 导出了 tb1 的建表语句;

4> 第四步:show fields from `tb1`; SELECT /*!40001 SQL_NO_CACHE */ * FROM `tb1`; 导出了表中的数据;

......

5> 最后导出了 trigger, 最后的最后 unlock tables; 结束。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/38784cef23fd1f12966185d2cc51010a.html