BRa*_*sad 4 mysql sql mysql-error-1075
这有效:
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)
)
Run Code Online (Sandbox Code Playgroud)
......而这个:
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)
)
Run Code Online (Sandbox Code Playgroud)
...结果是:
错误代码:1075 - 表定义不正确; 只能有一个自动列,必须将其定义为键
我添加了主键但仍然出错.
引用Bug#45987,ERROR 1075(42000):表定义不正确:
实际上,这不是服务器错误,只是MyISAM(假定为该手册页默认)与其他地方记录的InnoDB存储引擎之间的区别:http://dev.mysql.com/doc/refman/5.1/en/innodb-自动递增,handling.html
MyISAM不再是默认引擎; InnoDB是.
另外:http://bugs.mysql.com/bug.php?id = 60104
InnoDB不支持AUTO_INCREMENT,但没有为表定义主键,但MyISAM确实如此.选择要使用的引擎(MyISAM或InnoDB),并相应地处理CREATE TABLE语句.
| 归档时间: |
|
| 查看次数: |
8807 次 |
| 最近记录: |