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');