Here is my SQL script
CREATE TABLE tracks(
track_id int NOT NULL AUTO_INCREMENT,
account_id int,
track_name varchar(255),
track_path varchar(255),
track_art_path varchar(255),
track_desc text,
primary key(track_id),
FOREIGN KEY (account_id) REFERENCES accounts_profile(accnt_id)
)
I don’t see any syntax errors. Everything looks fine. My Database Engine is innoDB. but how come I keep on receiving this error?
#1005 - Can't create table 'beatbeast.tracks' (errno: 150)
It’s not showing what line where the error is.
Errno 150 is generally the result of a mismatch between the exact data types of the main table’s referenced column, and the referencing column. In your case,
tracks.account_idis a signedINT, but the column it referencesaccounts_profile.accnt_idisINT UNSIGNED. So you must create thetrackstable usingINT UNSIGNEDforaccount_idas well: