这个mysql查询怎么了? [英] What is wrong with this mysql query?

查看:58
本文介绍了这个mysql查询怎么了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这有效:

CREATE TABLE shoutbox_shout (
  shout_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  user_id INT UNSIGNED NOT NULL DEFAULT 0,
  shout_date INT UNSIGNED NOT NULL DEFAULT 0,
  message MEDIUMTEXT NOT NULL,
  KEY shout_date (shout_date)
)

...与此同时:

CREATE TABLE shoutbox_shout (
  shout_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  user_id INT UNSIGNED NOT NULL DEFAULT 0,
  shout_date INT UNSIGNED NOT NULL DEFAULT 0,
  message MEDIUMTEXT NOT NULL,
  KEY shout_date (shout_date)
)

...导致:

错误代码:1075-错误的表定义;只能有一个自动列,并且必须将其定义为键

Error Code: 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

我添加了主键,但仍然出现错误.

I added primary key but still get error.

推荐答案

引用错误#45987 ,错误1075(42000):错误的表格定义:

实际上,这不是服务器错误,只是MyISAM(该手册页默认为默认)和其他地方记录的InnoDB存储引擎之间的区别: MyISAM不再是默认引擎; InnoDB是.

MyISAM is no longer the default engine; InnoDB is.

也: http://bugs.mysql.com/bug.php?id= 60104

InnoDB不支持AUTO_INCREMENT,但是没有为表定义主键,但是MyISAM支持.选择要使用的引擎(MyISAM或InnoDB),并相应地处理CREATE TABLE语句.

InnoDB doesn't support AUTO_INCREMENT but no primary key being defined for the table, but MyISAM does. Choose which engine (MyISAM or InnoDB) you want to use, and deal with the CREATE TABLE statement accordingly.

这篇关于这个mysql查询怎么了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆