[英]#1075 MySQL Error
So i am just a beginner in all this php stuff. 所以我只是所有这些php内容的初学者。 I know just the basics, and when i setting up the settings for my new table, I met the problem #1075. 我只知道基础知识,当我为新表设置设置时,遇到了#1075问题。 Before, i created one, almost similar to this one, and i don't see the differenc. 以前,我创建了一个,几乎与此类似,并且没有区别。 Can you say me where is the problem and explain what is happening? 您能告诉我问题出在哪里并解释发生了什么吗?
CREATE TABLE `try`.`testing` ( `id` INT NOT NULL AUTO_INCREMENT , `date` DATE NOT NULL , `text_1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , `text_2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ) ENGINE = MyISAM;
here is the code of my SQL Preview. 这是我的SQL Preview的代码。 I use phpMyAdmin, obviously. 我显然使用phpMyAdmin。 Please, help me. 请帮我。 Thank, you) 谢谢)
Try this 尝试这个
CREATE TABLE `testing` (
`id` INT NOT NULL AUTO_INCREMENT,
`date` DATE NOT NULL,
`text_1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`text_2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = MYISAM ;
You have to declare your AUTO_INCREMENT
field as a primary key
or a key
. 您必须将AUTO_INCREMENT
字段声明primary key
或key
。 So you have to add PRIMARY KEY (id)
or KEY (id)
to your CREATE TABLE
statement: 因此,您必须在CREATE TABLE
语句中添加PRIMARY KEY (id)
或KEY (id)
:
CREATE TABLE `try`.`testing` (
`id` INT NOT NULL AUTO_INCREMENT,
`date` DATE NOT NULL ,
`text_1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`text_2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`) -- as primary key
KEY (`id`) -- or as key
) ENGINE = MyISAM;
Please also check: 另请检查:
https://stackoverflow.com/a/8114994/3647441 https://stackoverflow.com/a/8114994/3647441
https://stackoverflow.com/a/14087703/3647441 https://stackoverflow.com/a/14087703/3647441
For an autoincrement
field you should have some sort of index associated with it. 对于autoincrement
字段,您应该具有与其关联的某种索引。 eg: primary key
which is missing 例如:缺少的primary key
Try This. 尝试这个。
CREATE TABLE `try`.`testing` (
`id` INT NOT NULL AUTO_INCREMENT,
`date` DATE NOT NULL ,
`text_1` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`text_2` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
KEY (`id`)
) ENGINE = MyISAM;
https://dev.mysql.com/doc/refman/5.6/en/example-auto-increment.html https://dev.mysql.com/doc/refman/5.6/en/example-auto-increment.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.