mysql表删除异常

mysql表删除异常

exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1175 You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column' in /opt/home/gaoqi/deploy/framework/potato/storage/db/adapter/PDOAbstract.php:776

意思是where条件是一个非key的列且无limit,原因在于mysql设置了sql_safe_updates为ON,通过以下方式查看
mysql表删除异常_第1张图片

两种解决方法:
1 把该列设置成key即可

alter table tablename add index `idx_column_name` (column_name)

2 修改mysql配置

set sql_safe_updates=0; 或 set sql_safe_updates=off;

参考文档
https://stackoverflow.com/questions/30878073/error-code-1175-you-are-using-safe-update-mode-and-you-tried-to-update-a-table

你可能感兴趣的:(Mysql,数据库操作,数据库,MYSQL技术分享)