mysql报错:SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column ‘rule’ can’t have a...

多次遇到这个问题了,今天特意记录一下:

SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column 'city' can't have a default value 

解决办法:

windows在my.ini文件 linux 在my.cnf文件

中找到sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"这行,在这句前面加个“#”注释掉这行重启MYSQL就好了,如下:

# Set the SQL mode to strict
#sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.

转载于:https://www.cnblogs.com/aij-ling/p/9988113.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个错误是由于SQL语法错误或访问违规引起的。具体来说,错误信息中的"Syntax error or access violation: 1064"表示语法错误,"You have an error in your SQL syntax"表示你的SQL语法有错误。根据引用\[1\]中的错误信息,错误发生在"alter table `products` add constraint `products_category_id_foreign` foreign key (`category_id`) references `categories` (`id`) on delete setnull"这条SQL语句中。根据引用\[2\]中的错误信息,错误发生在"alter table blog_admins add unique blog_admins_email_unique(email)"这条SQL语句中。 要解决这个问题,你需要检查你的SQL语句是否符合MySQL的语法规范。可能的原因包括使用了错误的关键字、缺少必要的引号或括号、表或列名拼写错误等。你可以参考MySQL的官方文档或查询相关的错误信息来找到解决方法。另外,还要确保你的MySQL服务器版本与你使用的语法兼容。 如果你提供更多的代码或错误信息,我可以给出更具体的建议。 #### 引用[.reference_title] - *1* *3* [Syntax error or access violation: 1064 You have an error in your SQL syntax;](https://blog.csdn.net/sunjindeng123/article/details/109540500)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [SQLSTATE[42000]: Syntax error or access violation:](https://blog.csdn.net/xianhenyuan/article/details/103436361)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值