Mysql Workbench Create Table Error 1064
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers error 1064 mysql 42000 foreign key or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x
Mysql Error 1064
Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it
Error Code 1064 Mysql Create Table
only takes a minute: Sign up MySql Error 1064 - Created using MySQL WorkBench up vote 1 down vote favorite I created this using MySQL WorkBench CREATE TABLE IF NOT EXISTS `bakasura_new`.`cities` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT ,
Error Code 1064 You Have An Error In Your Sql Syntax
`name` VARCHAR(255) NOT NULL COMMENT 'City Name' , `short_name` VARCHAR(255) NOT NULL COMMENT 'Short Name' , `country_id` INT(11) UNSIGNED NOT NULL , PRIMARY KEY (`id`) , INDEX `fk_cities_countries` (`country_id` ASC) , ENGINE = InnoDB; I am getting this error MySQL said: Documentation #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 '= InnoDB' at line 8 mysql mysql-error-1064 create-table share|improve this question create table mysql edited Sep 26 '10 at 10:38 Daniel Vassallo 209k43387380 asked Sep 26 '10 at 10:30 Harsha M V 17.7k77252407 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted You have a dangling comma here: INDEX `fk_cities_countries` (`country_id` ASC) , And you also have a missing parenthesis at the end: CREATE TABLE IF NOT EXISTS `bakasura_new`.`cities` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL COMMENT 'City Name' , `short_name` VARCHAR(255) NOT NULL COMMENT 'Short Name' , `country_id` INT(11) UNSIGNED NOT NULL , PRIMARY KEY (`id`) , INDEX `fk_cities_countries` (`country_id` ASC) ) ENGINE = InnoDB; share|improve this answer answered Sep 26 '10 at 10:31 Daniel Vassallo 209k43387380 i tried that before.. doesnt work :( –Harsha M V Sep 26 '10 at 10:34 1 @Harsha M V: Just tried it myself, and it worked. Note that I removed a comma and added a closing parenthesis. –Daniel Vassallo Sep 26 '10 at 10:35 ouch.. sorry didnt notice that :D thanks a lot it worked :D –Harsha M V Sep 26 '10 at 10:40 add a comment| up vote 1 down vote There is a ) missing at the end of the last ) INDEX `fk_cities_countries` (`country_id` ASC) ) share|improve this answer answered Sep 26 '10 at 10:33 DrColossos 9,25522554 thank you. works now :D Mysql Workbench had created Constraints which i wanted to remove. guess
Updates: Status: Verified Impact on me: None Category:MySQL Workbench Severity:S2 (Serious) Version:6.3.4 OS:Microsoft Windows (Microsoft Windows 7 Professional Service Pack 1) Assigned update query in mysql to: Tags: WBBugReporter View Add Comment Files Developer Edit Submission View Progress mysql create table example Log Contributions [2 Aug 2015 23:36] Matt Searles Description: Workbench is generating invalid CREATE TABLE syntax. ... 08:41:29 [INF][ Workbench]: UI is up 08:41:30 [INF][ Workbench]: Running the application 08:42:35 [INF][ Canvas backend]: Found OpenGL version for this view: 4.2.12217 Compatibility Profile Context 12.104.0.0 08:55:56 [WRN][ TableEditorBE]: http://stackoverflow.com/questions/3797399/mysql-error-1064-created-using-mysql-workbench ENUM() is not a valid column typeFetching schema list. 09:14:24 [INF][ grt]: OK 09:14:54 [INF][ grt]: Executing SQL script in server 09:14:55 [ERR][ grt]: Error 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 'COMMENT '') ENGINE = InnoDB' at line 15 SQL https://bugs.mysql.com/bug.php?id=77910 Code: -- ----------------------------------------------------- -- Table `CmeRwc`.`Users` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `CmeRwc`.`Users` ( `UserId` INT NOT NULL AUTO_INCREMENT COMMENT '', `Username` VARCHAR(15) NOT NULL COMMENT '', `Password` VARCHAR(127) NOT NULL COMMENT '', `Email` VARCHAR(255) NOT NULL COMMENT '', `IsAdmin` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '', `Points` INT NOT NULL DEFAULT 0 COMMENT '', `CreatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '', `ModifiedOn` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '', `FirstName` VARCHAR(32) NULL COMMENT '', `Lastname` VARCHAR(32) NULL COMMENT '', PRIMARY KEY (`UserId`) COMMENT '') ENGINE = InnoDB 09:14:55 [INF][ grt]: SQL script execution finished: statements: 5 succeeded, 1 failed 09:14:55 [INF][ grt]: Fetching back view definitions in final form. 09:14:57 [INF][ grt]: Nothing to fetch 09:20:31 [INF][ grt]: Fetching schema list. 09:20:33 [INF][ grt]: OK ... How to repeat: 1) Create new model 2) Add tables, fields, foreign keys 3) Hit Forward Engineer or Synchronize Model Suggested fix: Default COMMENT to NULL not empty string [2 Aug 2015 23:42] Matt Searles Apologies, it seems its this line PRIMARY KEY (`UserId`)
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the http://dba.stackexchange.com/questions/16511/mysql-workbench-error-1064 company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish https://www.daniweb.com/programming/databases/threads/287185/create-table-error-1064 to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are create table voted up and rise to the top MySQL Workbench ERROR 1064 up vote 2 down vote favorite I have a problem with my database. I have created the model and now I want to sync it with my database on my WAMP Server (local) but it keeps giving me an error. I searched for the cause of the error for several days. Since I cannot find the problem, I've decided to share it with error code 1064 you. Message log: Executing SQL script in server ERROR: Error 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 ') NULL DEFAULT NULL , n_category VARCHAR(45) NULL DEFAULT NULL , PRIMARY K' at line 3 CREATE TABLE IF NOT EXISTS `telo2p`.`d_category` ( `idd_category` INT(11) NOT NULL AUTO_INCREMENT, `f_sells` DOUBLE(11) NULL DEFAULT NULL, `n_category` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`idd_category`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci SQL script execution finished: statements: 6 succeeded, 1 failed Any advice about what I am doing wrong here? mysql-5.5 mysql-workbench share|improve this question edited Sep 12 '12 at 13:16 Max Vernon 27.1k1160118 asked Apr 14 '12 at 9:49 Dimitris B 11314 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted Remove the (11) from the DOUBLE(11): `f_sells` DOUBLE NULL DEFAULT NULL , Approximate numeric dataypes (Float and Double) need no parameter. There is also a non-standard syntax with 2 parameters. From the MySQL docs, Floating-Point Types (Approximate Value): MySQL allows a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, “(M,D)” means that values can be stored with up to M digits in total, of which D digits may be after the decimal point. For exampl
don't see anything wrong here. Very basic but it is giving me a headache. Any suggestions are welcome. I am running version 5.1.37 and the error is: Error Code : 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 ''visit_recipes' ('id' INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 'name' text NO' at line 1 (0 ms taken) CREATE TABLE 'visit_recipes' ('id' INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 'name' text NOT NULL, 'ingredients' text NOT NULL, 'instructions' text NOT NULL, 'created_by' INTEGER NOT NULL, 'userip' VARCHAR(16), 'date_added' text NOT NULL, PRIMARY KEY('id')); mysql ProfessorPC 19 279 posts since Dec 2007 Community Member 2Contributors 1Reply 3Views 6 YearsDiscussion Span 6 Years Ago Last Post by griswolf 0 griswolf 304 6 Years Ago You appear to be translating from (postgresql?) where type text is the best option. In MySQL, varchar(size) is a better choice if possible. However, it does work, so I have not changed it. The syntax issue is the single quotes. If you want to quote table or column names, you need to use back-quote (`) not a normal quote ('). I've just removed your wrong quotes. This works for me: CREATE TABLE visit_recipes ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, name text NOT NULL, ingredients text NOT NULL, instructions text NOT NULL, created_by INTEGER NOT NULL, userip VARCHAR(16), date_added text NOT NULL ); This question has already been answered. Start a new discussion instead. Message Insert Code Snippet Alt+I Code Inline Code Link H1 H2 Preview Submit your Reply Alt+S Ask a Different Databases Question Related Articles ERROR 1005 (HY000): Can't create table 'jfunchio.movie_actor' (errno: 150) 1 reply Can anyone help me figure out why the table movie_actor cannot be created and how to fix it? I know it's the only table without … error ERROR 1005 (HY000): Can't create table 'jfunchio.rental' (errno: 150) 2 replies I need help creating the tables for my database, I've got all my tables to work except the first one. For some reason it says … Getting error ERROR 1005 (HY000): Can't create table 'jfunchio.rental' (errno: 150) 1 reply I keep getting the "ERROR 1005 (HY000): Can't create table 'jfunchio.rental' (errno: 150)" error where i run this code. I was wondering if anyone could … Dynamic table design 14 replies Dear All, For now I have two tables as below. The tblTyre store all the tyres.Then tblTyreConfig store the relevant tyreID in each of the … cannot import a tabl