zoukankan      html  css  js  c++  java
  • mysqldump导出数据自增属性丢失案例

    create table t9(id int not null auto_increment primary key,name varchar(20) not null default '');
    insert into t9 values(1,'a'),(2,'b'),(3,'c');
    select * from t9;

    mysql> show create table t9 G
    *************************** 1. row ***************************
    Table: t9
    Create Table: CREATE TABLE `t9` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(20) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4
    1 row in set (0.00 sec)


    mysqldump --single-transaction --set-gtid-purged=off --skip-opt -S /home/data/my3367/socket/mysqld.sock -uroot -proot db2 t9 > t9.sql


    --
    -- Table structure for table `t9`
    --

    /*!40101 SET @saved_cs_client = @@character_set_client */;
    /*!40101 SET character_set_client = utf8 */;
    CREATE TABLE `t9` (
    `id` int(11) NOT NULL,
    `name` varchar(20) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`)
    );
    /*!40101 SET character_set_client = @saved_cs_client */;

    --
    -- Dumping data for table `t9`
    --

    INSERT INTO `t9` VALUES (1,'a');
    INSERT INTO `t9` VALUES (2,'b');
    INSERT INTO `t9` VALUES (3,'c');

    导入后业务处理的时候提示:
    DBAPIError exception wrapped from (pymysql.err.InternalError) (1364, u"Field 'id' doesn't have a default value"

    欢迎多交流(QQ:616793474/329003748),谢谢!
  • 相关阅读:
    CF833 A The Meaningless Game
    [Noip2016]蚯蚓 (单调队列)
    [NOI2003]逃学的小孩 (贪心+树的直径+暴力枚举)
    [POI2014]FAR-FarmCraft (树规+贪心)
    洛谷P2566 [SCOI2009]围豆豆(状压dp+spfa)
    [POJ1852] Ants(思维题)
    树的深度(我觉得没毛病)
    HDU
    剑指offer相关问题
    CC150相关问题
  • 原文地址:https://www.cnblogs.com/imdba/p/15045560.html
Copyright © 2011-2022 走看看