Questions tagged [mysql-error-1075]

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

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

15 questions
218
votes
12 answers

Remove Primary Key in MySQL

I have the following table schema which maps user_customers to permissions on a live MySQL database: mysql> describe user_customer_permission; +------------------+---------+------+-----+---------+----------------+ | Field | Type | Null…
markb
  • 3,451
  • 5
  • 24
  • 25
44
votes
6 answers

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

Here is a table in MySQL 5.3.X+ db: CREATE TABLE members` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `memberid` VARCHAR( 30 ) NOT NULL , `Time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `firstname` VARCHAR( 50 ) NULL , …
Haradzieniec
  • 9,086
  • 31
  • 117
  • 212
35
votes
5 answers

mysql, alter column remove primary key and auto incremement

I'm changing my mysql db table from an id (auto) to a uid. ALTER TABLE companies DROP PRIMARY KEY; ALTER TABLE companies ADD PRIMARY KEY (`uuid`); This is the error I get.. [SQL] ALTER TABLE companies DROP PRIMARY KEY; [Err] 1075 - Incorrect table…
Brett
  • 2,537
  • 4
  • 19
  • 16
9
votes
3 answers

Mysql Error: #1075

SQL query: ALTER TABLE `blog` CHANGE `id` `id` BIGINT NOT NULL AUTO_INCREMENT MySQL said: #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key I am trying to create a blog, and I got the code…
user1888406
  • 97
  • 1
  • 1
  • 4
4
votes
6 answers

What is wrong with this mysql query?

This works: 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…
BRampersad
  • 862
  • 1
  • 12
  • 25
2
votes
2 answers

Is it possible to have an AUTO_INCREMENT column that permits duplicates?

I have a table that has an AUTO_INCREMENT field. Currently, it is also a PRIMARY KEY. However, there are situations where I need this AUTO_INCREMENT column to permit duplicates. In other words - two different rows can have the same value inside…
Runcible
  • 7,006
  • 12
  • 42
  • 62
1
vote
5 answers

Autoincrement Id and key problem (MySQL)

i have table and i tried to add `id` int(11) NOT NULL auto_increment, to table but i get ERROR 1075: Incorrect table definition; There can only be one auto column and it must be defined as a key So the questions are: How I can find which one is…
ivo tanev
  • 11
  • 1
  • 6
1
vote
3 answers

Problem with lunching Java app (Spring, Hibernate) on Debian (MySQL)

class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://127.0.0.1:3306/mysqljava"/> …
slavig
  • 339
  • 2
  • 6
  • 19
1
vote
6 answers

Auto increment column

I want to make an AUTO_INCREMENT column in a database table,here is the syntax i write: create table comments ( name varchar(20), mail varchar(30), comment varchar(100), com_no int auto_increment ); and i get the following…
Ahmed Waheed
  • 1,281
  • 5
  • 21
  • 39
1
vote
4 answers

#1075 MySQL Error

So i am just a beginner in all this php stuff. I know just the basics, and when i setting up the settings for my new table, I met the problem #1075. Before, i created one, almost similar to this one, and i don't see the differenc. Can you say me…
Godje
  • 404
  • 5
  • 15
0
votes
2 answers

#1062 - Duplicate entry '1' for key 1 when enabling Auto_increment

When I'm trying to enable auto_increment on a column in phpmyadmin, but I always get this error: #1062 - Duplicate entry '1' for key 1 The column in question is the PK and an INT. It already has several rows in it. Because of this, I tried the…
Chuck Le Butt
  • 47,570
  • 62
  • 203
  • 289
0
votes
2 answers

setting MySQL field uid as auto_increment

For some reason i keep getting the following error when i try to set my uid as auto_increment. I am using phpMyAdmin. Error SQL query: ALTER TABLE `ITEMS` ADD `uid` INT( 2 ) NOT NULL AUTO_INCREMENT FIRST , ADD `name` VARCHAR( 100 ) NOT NULL AFTER…
Denoteone
  • 4,043
  • 21
  • 96
  • 150
0
votes
1 answer

Moving Java (Spring, Hibernate, MySql) project from Windows to Debian

I am writing project on Windows (IntelliJIdea), and all OK. It compiles, and runs. But when I try to run on Debian(GNU/Linux 5.0), I have SEVERE: Access denied for user 'root'@'localhost' (using password: YES) [java] 30.11.2010 15:39:04…
slavig
  • 339
  • 2
  • 6
  • 19
0
votes
2 answers

how to design a table in mysql with two auto_increment fields

For a project we do the database design at the moment. We think we should use two auto_increment fields in one table. table master: `pid` int(10) NOT NULL auto_increment, `iid` int(10) NOT NULL auto_increment, ... To start with a alternate…
vbd
  • 3,437
  • 4
  • 32
  • 45
0
votes
3 answers

mysql ( innodb )foreign key constraints problems

I am running into a couple of issues while trying to generate foreign keys for my tables in MySql(Innodb). Can you please help me with them ? Referenced tables : *create table entity { PID INT(20) auto inc not null, ENTITYID INT(20) not null, …