LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 02-26-2009, 07:21 AM   #1
a_m0d
Member
 
Registered: Apr 2007
Location: Perth, WA, Australia
Distribution: Fedora 8, Fedora 10
Posts: 49

Rep: Reputation: 15
Question MySQL Error Code 1064 - MySQL Administrator


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.
 
Old 02-27-2009, 01:04 AM   #2
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
try:

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

Original Poster
Rep: Reputation: 15
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
 
Old 02-27-2009, 01:53 AM   #4
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
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
 
Old 02-27-2009, 02:11 AM   #5
a_m0d
Member
 
Registered: Apr 2007
Location: Perth, WA, Australia
Distribution: Fedora 8, Fedora 10
Posts: 49

Original Poster
Rep: Reputation: 15
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.
 
Old 02-27-2009, 03:15 AM   #6
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 463

Rep: Reputation: 36
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?
 
Old 02-27-2009, 04:02 AM   #7
a_m0d
Member
 
Registered: Apr 2007
Location: Perth, WA, Australia
Distribution: Fedora 8, Fedora 10
Posts: 49

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
error 1064 mysql Tredo Linux - Security 4 12-02-2004 05:24 PM
MySQL error 1064 tangle Linux - General 2 11-16-2004 01:17 AM


All times are GMT -5. The time now is 01:20 AM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration