MySQL Workbench Error 1064 -
everyone! i'm newbie mysql. i've created new model using workbench tools(i mean, haven't written string of code myself). when trying forward engineer get:
executing sql script in server error: error 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'comment '') engine = innodb' @ line 8 sql code: -- ----------------------------------------------------- -- table `university`.`city` -- ----------------------------------------------------- create table if not exists `university`.`city` ( `id_city` int not null comment '', `cname` text(15) null comment '', `population` int null comment '', primary key (`id_city`) comment '') engine = innodb sql script execution finished: statements: 5 succeeded, 1 failed fetching view definitions in final form. nothing fetch
moreover, when trying forward engineer default workbench model "sakila_full" same thing:
executing sql script in server error: error 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'comment '', index `idx_actor_last_name` (`last_name` asc) comment '') engine ' @ line 9 sql code: -- ----------------------------------------------------- -- table `sakila`.`actor` -- ----------------------------------------------------- create table if not exists `sakila`.`actor` ( `actor_id` smallint unsigned not null auto_increment comment '', `first_name` varchar(45) not null comment '', `last_name` varchar(45) not null comment '', `last_update` timestamp not null default current_timestamp comment '', primary key (`actor_id`) comment '', index `idx_actor_last_name` (`last_name` asc) comment '') engine = innodb default character set = utf8 sql script execution finished: statements: 5 succeeded, 1 failed fetching view definitions in final form. not definition sakila.customer_list server not definition sakila.film_list server not definition sakila.nicer_but_slower_film_list server not definition sakila.staff_list server not definition sakila.sales_by_store server not definition sakila.sales_by_film_category server not definition sakila.actor_info server 7 views read back.
thanks in advance!
it looks you've taken comment
strings little far. according the mysql create table
syntax, comment
attribute permitted on column definition. means it's invalid on index
or primary key
definitions have listed near end of create
statements.
the comment ''
aren't necessary , can omitted entirely, since leaving them blank. otherwise, used little bit of human-readable metadata on column definitions.
to working have, remove comment
attributes index , primary key definitions.
create table if not exists `university`.`city` ( `id_city` int not null comment '', `cname` text(15) null comment '', `population` int null comment '', -- no comment on pk primary key (`id_city`) ) engine = innodb; create table if not exists `sakila`.`actor` ( `actor_id` smallint unsigned not null auto_increment comment '', `first_name` varchar(45) not null comment '', `last_name` varchar(45) not null comment '', `last_update` timestamp not null default current_timestamp comment '', -- no comment on pk or index primary key (`actor_id`), index `idx_actor_last_name` (`last_name` asc) ) engine = innodb default character set = utf8;
or whole thing without any blank comment
s:
create table if not exists `university`.`city` ( `id_city` int not null comment 'a comment not blank!', `cname` text(15) null, `population` int null, primary key (`id_city`) ) engine = innodb;
(same other table)
mysql quite @ pointing directly source of syntax error error message:
check manual corresponds mysql server version right syntax use near 'comment ''),
with exception of errors occurring @ end of statement, little ambiguous, right syntax use near show what's amiss. in above case, comment '')
should direct comment
attribute followed )
, 1 @ primary key
. there, check manual (linked above) legal syntax in each segment of statement.
Comments
Post a Comment