mysq添加外键报错:check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 1

今天用navcat往一个表添加外键的时候报错:

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

排查之后发现是因为两个表的类型不一样所致:

SQL:SHOW TABLE STATUS 查询出数据表的状态,Engine那一列就是

使用语句修改表类型:ALTER TABLE `cms_channel` ENGINE = INNODB;

问题解决

===============================================================

顺便给出添加外键的sql语句:

alter table 表名 add constraint FK_ID foreign key(你的外键字段名) REFERENCES 外表表名(对应的表的主键字段名);

例子:

alter table cms_article add constraint FK_ARTICLE_DEPT_1 foreign key(dept_id) REFERENCES sys_department(id);

用这个语句运行的时候不会报错,客户端也会提示功能修改了多少条数据,但是重新查询数据库表结构的时候发现修改不成功,因为表类型不一样是不能建立外键的

mysq添加外键报错:check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 1

时间: 2024-08-06 06:15:58

mysq添加外键报错:check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 1的相关文章

check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 7

第一种是:解决MySQL的版本问题(我用的是mysql 5.5版本),mysql 5.0版本以后的数据库方言是:org.hibernate.dialect.MySQ5LInnoDBDialect.第二种是,如果你数据库方言用的是MySQLInnoDBDialect,这个要表存在才能用.可是你没建表,所以你应该改用MySQLDialect.以下是MySQLDialect和MySQLInnoDBDialect的区别:MySQLDialect:表名不存在下使用.MySQLInnoDBDialect:表

MySQLSyntaxErrorException: 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 ...

下面是我update数据库时打印出来的异常: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea

插入mysql语句报错: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

插入一个很简单的sql语句时候,mysql一直报错: [SQL] INSERT INTO ORDER ( id, activity_id, order_type, phone, order_amount, order_state, pay_type)VALUES ( '4', '2121313', '1', '13552444989', '1', '1', '1' ) [Err] 1064 - You have an error in your SQL syntax; check the man

MySQLSyntaxErrorException: 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 ':ge

数据库表里命名有这个字段,可怎么就是报错呢,大神的解释: 加上之后立马好用!!! MySQLSyntaxErrorException: 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 ':ge

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 '?,?,?,?)'

使用?占位符写MYSQL查询语句,执行报错 1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '?,?,?,?)' at line 1 2 at sun.ref

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 'where id = 2' at line 8

字典管理修改接口测试传了id后出现: 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 'where id = 2' at line 8 百度翻译:您的SQL语法有错误:请查阅与您的MySQL服务器版本相对应的手册,以获得在第8行“where id=2”附近使用的正确语法. 百度解

解决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 'order (order_name, customer)

在学习hibernate一对多映射关系时,根据视频学习的时候,例子是顾客和订单的问题,一个顾客有多个订单.按照视频中的敲代码出现了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 'order (order_name, customer) 原因是order是mysql关键字,不能做

MySQL check the manual that corresponds to your MySQL server version for the right syntax错误

地化GO的时候一直遇到一个错误就是check the manual that corresponds to your MySQL server version for the right syntax,反复检查过多次语句都没发现错误,后来网上搜索解决方法见到: http://hi.baidu.com/iamzhangxinxu/blog/item/6f925a310cb80c93a8018e37.html 遇到的check the manual that corresponds to your

C# Mysql 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 ????

有几年没用过MySql数据了,今天在使用C#访问MySql数据库时出现了一个小插曲. 错误提示: 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 ??? 当然,错误提示已经很明白的说明是sql的语法错误. 然而,我的sql 语句是 select count(*) from tab