LinuxQuestions.org
Have you listened to LQ Radio?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Thread Tools
Old 02-26-2009, 08:21 AM   #1
a_m0d
Member
 
Registered: Apr 2007
Location: Perth, WA, Australia
Distribution: Fedora 8, Fedora 10
Posts: 49
Thanked: 0
Question MySQL Error Code 1064 - MySQL Administrator


[Log in to get rid of this advertisement]
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.
a_m0d is offline     Reply With Quote
Old 02-27-2009, 02:04 AM   #2
Admiral Beotch
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 670
Blog Entries: 3
Thanked: 104
try:

Code:
CREATE TABLE `cabinetsDB`.`TabManufacturers` (
  `manufacturerID` INT  NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `manufacturerName` VARCHAR  NOT NULL
);
Admiral Beotch is offline     Reply With Quote
Old 02-27-2009, 02:34 AM   #3
a_m0d
Member
 
Registered: Apr 2007
Location: Perth, WA, Australia
Distribution: Fedora 8, Fedora 10
Posts: 49
Thanked: 0

Original Poster
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
a_m0d is offline     Reply With Quote
Old 02-27-2009, 02:53 AM   #4
Admiral Beotch
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 670
Blog Entries: 3
Thanked: 104
Hmm. Sorry, I got nuthin.

The only thing I can think of is to try some minor syntax changes like:

Code:
USE cabinetsDB;
CREATE TABLE TabManufacturers (
  manufacturerID INT  NOT NULL AUTO_INCREMENT PRIMARY KEY,
  manufacturerName VARCHAR  NOT NULL
);
...taking the db out of the namespace and removing the single quotes (they actually looked like back ticks) since there were no spaces in the names...

If that doesn't work, a real mysql guru will be by shortly to bitch slap me and help you out. 8D
Admiral Beotch is offline     Reply With Quote
Old 02-27-2009, 03:11 AM   #5
a_m0d
Member
 
Registered: Apr 2007
Location: Perth, WA, Australia
Distribution: Fedora 8, Fedora 10
Posts: 49
Thanked: 0

Original Poster
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.
a_m0d is offline     Reply With Quote
Old 02-27-2009, 04:15 AM   #6
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 393
Thanked: 0
Hi,
MySQL DB version, compiled/rpm? What user are you using and what are permisson set for that user in mysql.user table?

Can you create any database?
tanveer is offline     Reply With Quote
Old 02-27-2009, 05:02 AM   #7
a_m0d
Member
 
Registered: Apr 2007
Location: Perth, WA, Australia
Distribution: Fedora 8, Fedora 10
Posts: 49
Thanked: 0

Original Poster
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.
a_m0d is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 04:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
error 1064 mysql Tredo Linux - Security 4 12-02-2004 06:24 PM
MySQL error 1064 tangle Linux - General 2 11-16-2004 02:17 AM


All times are GMT -5. The time now is 08:26 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration