ERROR 1364 (HY000): Field 'xxx' doesn't have a default value

是啊,因为auto_random是在comments里面的关系。 但这个和show create table不就是和实际不等效了吗。如果我们用mysqldump到处定义,就会有问题了。
mysqldump -h 192.168.0.xxx -P 4000 -u root -pxxx -B raydb -d > test.log
DROP TABLE IF EXISTS testrb;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/
!40101 SET character_set_client = utf8 */;
CREATE TABLE testrb (
id bigint(20) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,
name varchar(2) DEFAULT NULL,
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_rand_base] AUTO_RANDOM_BASE=30001 /;
/
!40101 SET character_set_client = @saved_cs_client */;


– Table structure for table testrb2

DROP TABLE IF EXISTS testrb2;
/*!40101 SET @saved_cs_client = @@character_set_client /;
/
!40101 SET character_set_client = utf8 */;
CREATE TABLE testrb2 (
id bigint(20) NOT NULL,
name varchar(2) DEFAULT NULL,
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED /
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/
!40101 SET character_set_client = @saved_cs_client */;