简体   繁体   English

#1075 MySQL错误

[英]#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 keykey 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.

相关问题 mysql中的错误1075 - Error no 1075 in mysql mysql 错误:#1075 - Mysql Error: #1075 MySQL-将MyISAM转换为InnoDB并收到错误1075 - MySQL - convert MyISAM into InnoDB getting error 1075 错误1075:表定义不正确; 只能有一个自动列,它必须被定义为一个键(使用 gorm 和 mysql) - Error 1075: Incorrect table definition; there can be only one auto column and it must be defined as a key (using gorm and mysql) 向 MySQL 发出命令时,出现错误“#1075 - 表定义不正确;” - When issuing a command to MySQL, I'm getting that error "#1075 - Incorrect table definition;" MySQL:#1075 - 不正确的表定义; 自动增量与另一个键? - MySQL: #1075 - Incorrect table definition; autoincrement vs another key? MySQL-1075错误的表格定义,只能有一个自动列,必须将其定义为键 - MySQL - 1075 Incorrect table definition, there can be only one auto column and it must be defined as a key 错误1075:错误的表格定义; 只能有一个自动列,并且必须将其定义为键 - ERROR 1075: Incorrect table definition; there can be only one auto column and it must be defined as a key ERROR 1075 表定义不正确; 只能有一个自动列,并且必须将其定义为键 - ERROR 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key Auto_Increment:如何自动组合键的组合(错误1075) - Auto_Increment: how to auto_increment a combined-key (ERROR 1075)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM