I have got errors when I tried to install the MySQL tables, error:
"#1064 - You have an error in your SQL syntax"
and error:
"#1068 - Multiple primary key defined "
This is the database:
CREATE TABLE messages (
msg_id INT PRIMARY KEY AUTO_INCREMENT,
message VARCHAR(200),
uid_fk INT(10),
ip VARCHAR(45),
created INT(10),
uploads VARCHAR(50),
profile_uid INT(10)
PRIMARY KEY (`msg_id`),
KEY `uid_fk` (`uid_fk`)
);
CREATE TABLE comments (
com_id INT PRIMARY KEY AUTO_INCREMENT,
comment VARCHAR(200),
msg_id_fk INT(10),
uid_fk INT(10),
ip VARCHAR(45),
created INT(10),
PRIMARY KEY (`com_id`),
KEY `msg_id_fk` (`msg_id_fk`),
KEY `uid_fk` (`uid_fk`)
);
CREATE TABLE likes (
like_id INT PRIMARY KEY AUTO_INCREMENT,
msg_id_fk INT(10),
uid_fk INT(10),
PRIMARY KEY (`like_id`),
KEY `msg_id_fk` (`msg_id_fk`),
KEY `uid_fk` (`uid_fk`)
);
CREATE TABLE user_uploads (
id INT PRIMARY KEY AUTO_INCREMENT,
image_path VARCHAR(500),
uid_fk INT(10),
PRIMARY KEY (`id`),
KEY `uid_fk` (`uid_fk`)
);
CREATE TABLE follow_user (
fid INT PRIMARY KEY AUTO_INCREMENT,
uid_fk INT(10),
following_uid INT(10),
PRIMARY KEY (`fid`),
KEY `uid_fk` (`uid_fk`)
);
these are the errors images:
How to fix it?
Either use the inline syntax (msg_id INT PRIMARY KEY AUTO_INCREMENT
) or declare it afterwards (PRIMARY KEY (
com_id)
), not both : they conflict.