欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

MySQL遇到的报错信息(截止到7.17)

程序员文章站 2022-04-11 21:57:36
1.ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a keymysql> create table grades06( -> id int not null auto_increment, -> name varchar(12) primary key, -> grade float def...

-----------------------------------------------------------------7.16---------------------------------------------------------------
1.ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key

mysql> create table grades06(
    -> id int not null auto_increment,
    -> name varchar(12) primary key,
    -> grade float default 0);
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key

自增列只能有1列, 且这列必须为key,改后如下:

mysql>  create table grades06(
    ->  id int not null auto_increment primary key,
    -> name varchar(12),
    -> grade float default 0);
Query OK, 0 rows affected (0.02 sec)

2.Multiple primary key defined
定义了多个主键,我们要知道每个数据表最多只能有一个主键约束。
3.Incorrect prefix key; the used key part isn’t a string, the used length is longer than the key part, or the storage engine doesn’t support unique prefix keys
索引中的的长度超出了字段数据类型定义的长度。解决办法是索引中不写长度,或者把长度改到相应的长度以内。
-----------------------------------------------------------------7.17---------------------------------------------------------------
4.ERROR 1364 (HY000): Field ‘xxxx’ doesn’t have a default value,
字段xxxx为非空约束,不能插入空值。

本文地址:https://blog.csdn.net/m0_45240384/article/details/107383097