compact mysql_mysqldump的一个大失误.关于--compact参数使用不当的教训...记录...备用......

mysql> desc test;

+-------+-------------+------+-----+-------------------+-----------------------------+

| Field | Type        | Null | Key | Default           | Extra                       |

+-------+-------------+------+-----+-------------------+-----------------------------+

| id    | int(11)     | YES  |     | NULL              |                             |

| txt   | varchar(20) | YES  |     | NULL              |                             |

|time  | timestamp  | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |

| time2 | datetime    | YES  |     | NULL              |                             |

+-------+-------------+------+-----+-------------------+-----------------------------+

4 rows in set (0.00 sec)

mysql> select * from test;

+------+------+---------------------+---------------------+

| id   | txt  | time                | time2               |

+------+------+---------------------+---------------------+

|    1 | test | 2015-07-09 10:14:47 | 2015-07-09 10:14:47 |

|    2 | test | 2015-07-09 10:14:50 |2015-07-09 10:14:50 |

|    3 | test | 2015-07-09 10:14:53 | 2015-07-09 10:14:53 |

|    4 | test | 2015-07-09 10:14:56 |2015-07-09 10:14:56 |

|    5 | test | 2015-07-09 10:14:59 | 2015-07-09 10:14:59 |

+------+------+---------------------+---------------------+

5 rows in set (0.00 sec)

[root@localhost ~]# mysqldump --compact --database test1 >test1.sql

Warning: Using unique option prefix database instead of databases is deprecated  and will be removed in a future release. Please use the full name  instead.

[root@localhost ~]# more test1.sql

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test1` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `test1`;

/*!40101 SET @saved_cs_client     = @@character_set_client */;

/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `test` (

`id` int(11) DEFAULT NULL,

`txt` varchar(20) DEFAULT NULL,

`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

`time2` datetime DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*!40101 SET character_set_client = @saved_cs_client */;

INSERT INTO `test` VALUES (1,'test','2015-07-09 02:14:47','2015-07-09 10:14:47'),(2,'test','2015-07-09 02:14:50','2015-07-09 10:14:50'),(3,'test','2015-07-09 02:14:53',

'2015-07-09 10:14:53'),(4,'test','2015-07-09 02:14:56','2015-07-09  10:14:56'),(5,'test','2015-07-09 02:14:59','2015-07-09  10:14:59');

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值