MySQL server version for the right syntax to use near 'type=InnoDB' at line 1
2014-10-17 08:14
603 查看
转载请注明出处:http://blog.csdn.net/bettarwang/article/details/40180271
在运行一个Hibernate的示例时,配置了<property name="hibernate.hbm2ddl.auto">update</property>属性,但是自动建表却一直不成功,出错信息为:
ERROR: HHH000388: Unsuccessful: create table info_table (id integer not null auto_increment, title varchar(255), content varchar(255), primary key (id)) type=InnoDB
ERROR: 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 'type=InnoDB' at line 1
很显然,这是MySQL的版本问题导致的,实际上,在MySQL5.0以前,type=InnoDB是有效的SQL语句,但是自己用的是MySQL5.5版本,type=InnoDB不再有效了。
解决办法就是修改hibernate.cfg.xml中的dialect属性,将
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>修改为
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
再次运行,发现可以自动建表了。
在运行一个Hibernate的示例时,配置了<property name="hibernate.hbm2ddl.auto">update</property>属性,但是自动建表却一直不成功,出错信息为:
ERROR: HHH000388: Unsuccessful: create table info_table (id integer not null auto_increment, title varchar(255), content varchar(255), primary key (id)) type=InnoDB
ERROR: 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 'type=InnoDB' at line 1
很显然,这是MySQL的版本问题导致的,实际上,在MySQL5.0以前,type=InnoDB是有效的SQL语句,但是自己用的是MySQL5.5版本,type=InnoDB不再有效了。
解决办法就是修改hibernate.cfg.xml中的dialect属性,将
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>修改为
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
再次运行,发现可以自动建表了。
相关文章推荐
- You have an error MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 20
- MySQL server version for the right syntax to use near 'type = InnoDB' at line 25
- MySQL server version for the right syntax to use near 'type=InnoDB' at line 1
- MySQL server version for the right syntax to use near ';) T' at line 7
- MySQL server version for the right syntax to use near 'info where info.stu_id = 1' at line 1
- mysql报错:MySQL server version for the right syntax to use near type=InnoDB的解决方法
- your MySQL server version for the right syntax to use near 'NULL' at line 1
- MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1
- MySQL server version for the right syntax to use near '-1.stu stu0_' at line 1
- mysql报错:MySQL server version for the right syntax to use near type=InnoDB的解决方法
- Hibernate初运行异常---:MySQL server version for the right syntax to use near 'type=InnoDB'
- mysql报错:MySQL server version for the right syntax to use near 'type=InnoDB'
- MySQL server version for the right syntax to use near 'TYPE=MyISAM'
- MySQL server version for the right syntax to use near ‘USING BTREE
- MySql 执行语句错误 Err] 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
- check the manual that corresponds to your MySQL server version for the right syntax to use near 'oiw
- corresponds to your MySQL server version for the right syntax to use near 'describe)values(225,0,'aa
- heck the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTI
- check the manual that corresponds to your MySQL server version for the right syntax to use near 'USI
- check the manual that corresponds to your MySQL server version for the right syntax to use near