Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am trying to create a simple table in MySQL Administrator, but every time I press apply changes and then execute, it comes up with an error. Here is the SQL code:
Code:
CREATE TABLE `cabinetsDB`.`TabManufacturers` (
`manufacturerID` INT NOT NULL AUTO_INCREMENT,
`manufacturerName` VARCHAR NOT NULL,
PRIMARY KEY (`manufacturerID`)
)
ENGINE = MyISAM;
and here is the error message:
Code:
Error executing SQL commands to create table.
MySQL Error Nr. 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL,
PRIMARY KEY (`manufacturerID`)
)
ENGINE = MyISAM' at line 3
Any insight would be appreciated. I think that this must be a bug, since I haven't changed any of the SQL code - it is exactly as generated by MySQL Admin.
Sorry, still doesn't work. Here is the error message:
Code:
Error executing SQL commands to create table.
MySQL Error Nr. 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL
)' at line 3
No, it still doesn't work. It almost seems to be a problem with the server rather than the code. I know that I have got the permissions necessary to do this - I have even tried it with root access. So it certainly isn't a permissions problem, and I can't think of anything else it could be, since it seems to be valid syntax.
Hi, Sorry for all the hassle. I worked out what was wrong. For some reason, when I select a VARCHAR or CHAR field type, MySQL Admin does not create a length for the field, even though the correct syntax should be VARCHAR(lenght). Adding this by hand fixed my problem, however there is actually no option that I can see in MySQL Admin to let you set this length. Maybe this is a bug? Anyway, thanks for the help guys.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.