mysql delete from table 失败
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
TRUNCATE TABLE name
truncate语句,是清空表中的内容,包括自增主键的信息。truncate表后,表的主键就会重新从1开始。
check the manual that corresponds to your Mysql server version for the right syntax to yse near '-' at line 1
[Msg] [Imp] Import table [bridge02]
[Err] [Imp] 1452 - Cannot add or update a child row: a foreign key constraint fails (`mydb`.`bridge02`, CONSTRAINT `TRSD_id2` FOREIGN KEY (`TRSD_id`) REFERENCES `trsd_adr_vli` (`TRSD_id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
[Err] [Imp] INSERT INTO `bridge02` (`TRSD_pos`,`TRSD_id`,`TRCD_id`,`TRED_id`) VALUES ('20','11',NULL,'3'),('30','11',NULL,'21'),('40','11',NULL,'155'),('0','0',NULL,NULL)
[Msg] [Imp] Processed:5, Added:1, Updated:0, Deleted:0, Errors:4
[Msg] [Imp] Finished - Unsuccessfully
mysql> delete from users_table where id =1;
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails。。。问题解决
在MySQL在InnoDB中设置了foreign key关联,造成无法更新或删除数据。可以通过设置FOREIGN_KEY_CHECKS变量来避免这种情况。
在命令行中输入:
SET FOREIGN_KEY_CHECKS = 0;
删除完成后设置
SET FOREIGN_KEY_CHECKS = 1;
这样再select发现已经删除成功!
truncate table 表名;
delete from 表名;
- 醉了,mysql的删除居然变得这么麻烦 delete from table where id in()
- create stored procs Cannot load from mysql.proc. The table is probably corrupted
- mysql中You can't specify target table for update in FROM clause错误
- Cannot load from mysql.proc. The table is probably corrupted
- MySQL 错误码: 1093 You can't specify target table 'jc_user' for update in FROM clause
- MySQL 中 You can't specify target table '表名' for update in FROM clause错误解决办法
- 修复mysql 5.1升级至5.5出现的BUG: Cannot load from mysql.proc. The table is probably corrupted
- mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法
- MySQL can’t specify target table for update in FROM clause
- MySQL [Err] 1093 - You can't specify target table 'test' for update in FROM clause
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- mysql中You can’t specify target table for update in FROM clause错误解决方法
- Cannot load from mysql.proc. The table is probably corrupted
- 查询升级1548-Cannot load from mysql.proc. The table is probably corrupted
- sql server delete from tablename a 提示a附近有语法错误的问题
- delete from tablea & truncate table tablea 的区别??
- MySQL错误:You can't specify target table 'tablename' for update in FROM clause
- mysql 的delete from 子查询限制
- mysql copy data from table to another
- mysql中delete table和truncate table的区别