`

BLOB/TEXT column can't have a default value

阅读更多
BLOB/TEXT column can't have a default value
TEXT类型的表字段不能够有默认值


原因在于:

1.MYSQL5.x是不允许BLOB/TEXT类型的字段拥有默认值的。

2.由于MYSQL是在‘strict mode’严格模式下工作的,如果改为非严格模式,上面的语句就可以执行成功

3.MYSQL5.x在windows下是默认以‘strict mode’工作的,当执行上面的语句时,会给你一个错误或者警告信息

解决方法:

1.在my.ini文件中注释掉sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

2.或者BOLD/TEXT类型不设置默认值
分享到:
评论

相关推荐

    MySQL使用TEXT/BLOB类型的知识点详解

    Strict Mode下不能设置默认值,否则会报can’t have a default value错: mysql> create table `test`.`text_blob`( -> `a_text` text DEFAULT ' ' , -> `b_blob` blob -> ); ERROR 1101 (42000): BLOB/TEXT ...

    Python Cookbook, 2nd Edition

    Getting a Value from a Dictionary Recipe 4.10. Adding an Entry to a Dictionary Recipe 4.11. Building a Dictionary Without Excessive Quoting Recipe 4.12. Building a Dict from a List of ...

    Spectral Core Full Convert Enterprise v6.11.0.1683

    Free-style data type and default value modification per column Source table filtering (SQL where condition specification) Project Customization Conversion step modification (create table, indexes, ...

    Oracle sqldeveloper without jdk (win+linux)

    - Bug 5084677: When a table to be edited contains a column with byte length semantics, the Edit Table dialog box will not initialize the value in the Units pop-up list to BYTE. Workaround: Select ...

    Delphi7.1 Update

    open the d7.ohi file in the Delphi7Help folder and comment out one or more of the index entries by changing the colon in column one to a semi-colon, as shown here: ;Index Open Tools API (IOTA)=d7iota...

    Hibernate注释大全收藏

    定义 name 属性映射到 flight_name column, not null, can't update, length equal 50 @Column( name="columnName"; (1) 列名 boolean unique() default false; (2) 是否在该列上设置唯一约束 boolean nullable...

    sqlmap (懂的入)

    Here is a list of major features implemented in sqlmap: * Full support for MySQL, Oracle, PostgreSQL and Microsoft SQL Server database management system back-end. Besides these four DBMS, sqlmap ...

    oracle学习文档 笔记 全面 深刻 详细 通俗易懂 doc word格式 清晰 连接字符串

    blob 1~4GB 以二进制信息保存数据 三、 DDL语言 1. Create table命令 用于创建表。在创建表时,经常会创建该表的主键、外键、唯一约束、Check约束等  语法结构 create table 表名( [字段名] [类型] [约束] ……...

    MYSQL常用命令大全

    5.BLOB TEXT类型,最大长度为65535(2^16-1)个字符。 6.VARCHAR型:变长字符串类型 5.导入数据库表  (1)创建.sql文件  (2)先产生一个库如auction.c:mysqlbin>mysqladmin -u root -p creat auction,会...

    MySQL命令大全

    5.BLOB TEXT类型,最大长度为(2^16-1)个字符。 6.VARCHAR型:变长字符串类型 5.导入数据库表  ()创建.sql文件  ()先产生一个库如auction.c:mysqlbin>mysqladmin -u root -p creat auction,会提示输入...

    Doctrine ORM for PHP.pdf

    Table of Contents Introduction....................................................................................................13 Code Examples.........................................................

Global site tag (gtag.js) - Google Analytics