[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. 请用中文说出怎样解决呢? As indicated by the warning, to turn off the nonstandard behaviors, enable the new explicit_defaults_for_timestamp system variable at server startup. With this variable enabled, the server handles TIMESTAMP as follows instead: TIMESTAMP columns not explicitly declared as NOT NULL permit NULL values. Setting such a column to NULL sets it to NULL, not the current timestamp. No TIMESTAMP column is assigned the DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP attributes automatically. Those attributes must be explicitly specified. TIMESTAMP columns declared as NOT NULL and without an explicit DEFAULT clause are treated as having no default value. For inserted rows that specify no explicit value for such a column, the result depends on the SQL mode. If strict SQL mode is enabled, an error occurs. If strict SQL mode is not enabled, the column is assigned the implicit default of “”0000-00-00 00:00:00″” and a warning occurs. This is similar to how MySQL treats other temporal types such as DATETIME. |
|
MYSQL什么版本,字段是是什么类型
|
|
MySQL Server 5.6
echo starting mysql… |
|
然后出现
starting mysql… 接着出现 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details). 网上说: |
|
8分 |
检查你的 my.ini 中的参数文件中这个参数。
|
刚刚网上找到这个的:
启动如果有这个警告 添加 默认配置没开查询缓存哦亲~ 刚刚在测试服务器上升级完 /usr/local/share/mysql/有innodb_memcached_config.sql |
|
添加
代码: mysql_args=”–explicit_defaults_for_timestamp” —————- 请问这句代码添加到哪里呢? my.ini 或者 php.ini |
|
我也遇到同样的问题了 楼主解决了吗 ?
|
|
7分 |
刚刚查了下 楼主可以用管理员权限打开cmd 之后进入目录后执行mysqld -install 我的就这么解决的
|
15分 |
直接在mysql.cnf里的mysqld下加一行explicit_defaults_for_timestamp
|
my.ini
添加: explicit_defaults_for_timestamp 搞不懂这句是怎么用的 :mysql_args=”–explicit_defaults_for_timestamp” |
|
编译的时候吧. |
|
还是在my.cnf加上边这一句. |
|
在my.ini mysqld 下添加 explicit_defaults_for_timestamp=true
|
|
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data innodb_buffer_pool_size = 128M #开启查询缓存 添加后就不再显示错误了。 |
|
正如警告语说的,要关掉这种非标准行为,得在启动服务前开启系统变量explicit_defaults_for_timestamp! 如此,系统方能按如下的方式处理timestamp:
timestamp榄没有显式声明为not null的将会允许null值。设置为null就会是null,而不是当前timestamp! 没有timestamp榄会被自动赋值为default current_timestamp或on update current_timestamp。而是要显式去赋值! timestamp榄声明为not null并且没有显式声明一个默认值将被认定为没有默认值。向这样的榄插入记录将完全看SQL模式的心情。如果是strict模式,就报错! |