user1385257
user1385257

Reputation: 29

Error 1064 <42000> on mysql when i'm trying to create table

CREATE TABLE `photos` (
   `title` varchar(255) not null,
   `id` int(11) not null,
   `ph_path` varchar(255) not null,
   `description` varchar(255) not null,
   `privilange` varchar(20) not null,
   `owner` varchar(60) not null,
   `provoles` int(11),
   PRIMARY KEY (`id`),

) ENGINE=InnoDB DEFAULT CHARSET=greek;

I'm getting error 1064 <4200> and I'm not sure what is wrong.

Upvotes: 0

Views: 18399

Answers (2)

Nico
Nico

Reputation: 473

You will have to remove the comma after PRIMARY KEY (`id`).

Upvotes: 2

Michael Berkowski
Michael Berkowski

Reputation: 270707

You have a trailing comma in the primary key:

PRIMARY KEY (`id`), <--- remove that

The full error would read something like:

check the manual that corresponds to your MySQL server version for the right syntax to use near ') ENGINE=InnoDB

In MySQL, the position pointed to by the error message (near ')ENGINE) will show you the character immediately after where the error occurred. Look to the previous thing in your statement and you'll find your syntax error.

Upvotes: 3

Related Questions