1. 程式人生 > >mysql報錯:SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column ‘rule’ can’t have a default value

mysql報錯:SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column ‘rule’ can’t have a default value

多次遇到這個問題了,今天特意記錄一下:

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.