问题标签 [mysql-error-1075]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
6 回答
10482 浏览

mysql - 这个mysql查询有什么问题?

这有效:

...而这:

...结果是:

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

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

0 投票
6 回答
177764 浏览

mysql - MySQL: #1075 - Incorrect table definition; autoincrement vs another key?

Here is a table in MySQL 5.3.X+ db:

Id column is never used in queries, it is just for visual convenience (so it's easy to see how the table grows). Memberid is an actual key, is unique, and memberid is used in queries to identify any member (WHERE memberid='abcde').

My question is: how to keep auto_increment, but make memberid as a primary key? Is that possible? When I try to create this table with PRIMARY KEY (memberid), I get an error:

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

What is the best choice (Hopefully, there is a way to keep id column so performance is good and queries identify any user by memberid, not by id), if the performance is very important (although the disk space is not)?

0 投票
2 回答
5316 浏览

mysql - #1062 - 启用 Auto_increment 时键 1 的重复条目“1”

当我尝试auto_increment在 phpmyadmin 中的列上启用时,但我总是收到此错误:

有问题的列是 PK 和一个 INT。它已经有几行了。因此,我尝试了以下方法:

这应该将自动递增设置为从 7 开始,因此跳过该行中已经存在的 0 到 6 ......但它不起作用。或者这就是理论。

我究竟做错了什么?


更新:

我已尝试删除列上的 PK 索引并运行将列设置为NULL. 一切都设置为NULL。然后我尝试添加auto increment,但出现以下错误:#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key. 我尝试再次添加 PK 索引并获得以下内容#1062 - Duplicate entry '0' for key 1。啊。

0 投票
3 回答
33767 浏览

mysql - mysql 错误:#1075

SQL查询:

MySQL 说:

我正在尝试创建一个博客,并且我完成了代码。现在,我需要id自动增加,但我得到了这个错误。为什么我会得到这个?

0 投票
4 回答
395 浏览

mysql - #1075 MySQL 错误

所以我只是所有这些 php 东西的初学者。我只知道基础知识,当我为我的新表设置设置时,我遇到了问题 #1075。之前,我创建了一个,几乎与这个相似,但我看不出有什么不同。你能告诉我问题出在哪里并解释发生了什么吗?

这是我的 SQL Preview 的代码。显然,我使用 phpMyAdmin。请帮我。谢谢)