mysql> DROP TABLE IF EXISTS `privatesubscribeinfo`;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> CREATE TABLE `privatesubscribeinfo` (
    ->   `channelsubscribeid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    ->   `channelid` bigint(20) unsigned NOT NULL,
    ->   `usertype` char(1) NOT NULL,
    ->   `username` varchar(32) DEFAULT NULL,
    ->   `customerid` bigint(20) DEFAULT NULL,
    ->   `loginid` bigint(20) DEFAULT NULL,
    ->   `createdate` datetime DEFAULT NULL,
    ->   PRIMARY KEY (`channelsubscribeid`),
    ->   UNIQUE KEY `UI_private_channel` (`channelid`,`username`,`loginid`) USING BTREE
    -> ) ENGINE=InnoDB AUTO_INCREMENT=1000000000000030 DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.01 sec)mysql> 
mysql> 
mysql> insert into privatesubscribeinfo(channelid,usertype) select 1,'a';
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0mysql> select * from privatesubscribeinfo;
+--------------------+-----------+----------+----------+------------+---------+------------+
| channelsubscribeid | channelid | usertype | username | customerid | loginid | createdate |
+--------------------+-----------+----------+----------+------------+---------+------------+
|   1000000000000030 |         1 | a        | NULL     |       NULL |    NULL | NULL       |
+--------------------+-----------+----------+----------+------------+---------+------------+
1 row in set (0.00 sec)mysql> 

解决方案 »

  1.   

    楼主,你看我的不是从1000000000000030开始的吗?我的版本是5.6.12,楼主你的mysql版本是多少?
    bigint的最大值是
    9223372036854775807
    而你的初始值是
    1000000000000030
    所以应该不会有问题的。
      

  2.   

    楼主是如何测试的? 不会是把channelsubscribeid 也输入了值吧。
      

  3.   

    那到不会,插入的时候channelsubscribeid 肯定是没有输入值的。 我也纳闷呢,看着脚本是没问题,发给测试的怎么整出了channelsubscribeid 从1开始的。