[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Mysql error no 1064

Posted on 2008-11-07
1
Medium Priority
?
566 Views
Last Modified: 2012-05-05
Hello,

Following is a script generated directly by MySql Workbench:

CREATE TABLE IF NOT EXISTS `testDB`.`tb_user` (
`id_user` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
`ch_username` CHAR(15) NOT NULL ,
`ui_userType` INT UNSIGNED NULL ,
PRIMARY KEY (`id_user`) ,
UNIQUE INDEX `idx_ch_username` (`ch_username` ASC) ,
INDEX `fk_user_usertype` (`ui_userType` ASC) ,
CONSTRAINT `fk_user_usertype`
FOREIGN KEY (`ui_userType` )
REFERENCES `testDB`.`tb_userType` ()
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

When running this script in query browser, or command line, it gives me this error:
Error No: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 ')
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB' at line 10

I can not see any syntax error.
Any help would be appreciated
0
Comment
Question by:Ziphyre
1 Comment
 
LVL 26

Accepted Solution

by:
Umesh earned 1000 total points
ID: 22907015
Column name missing..

REFERENCES `testDB`.`tb_userType` (COLUMN_NAME_HERE)
CREATE TABLE IF NOT EXISTS `testDB`.`tb_user` (
`id_user` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
`ch_username` CHAR(15) NOT NULL ,
`ui_userType` INT UNSIGNED NULL ,
PRIMARY KEY (`id_user`) ,
UNIQUE INDEX `idx_ch_username` (`ch_username` ASC) ,
INDEX `fk_user_usertype` (`ui_userType` ASC) ,
CONSTRAINT `fk_user_usertype`
FOREIGN KEY (`ui_userType` )
REFERENCES `testDB`.`tb_userType` () ON DELETE NO ACTION ON UPDATE NO ACTION)ENGINE = InnoDB; 

Open in new window

0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question