VPS侦探论坛

 找回密码
 注册
查看: 2492|回复: 5

lnmp1.9安装完成后,mysql导入数据库Invalid default value for 'time'

[复制链接]
发表于 2022-6-27 15:34:15 | 显示全部楼层 |阅读模式

之前用的lnmp1.6,mysql5.6,导出数据库,现在换了服务器装的inmp1.9,mysql5.6,在导入数据库的时候提示Invalid default value for 'time',修改了my.cnf的sql_mode,添加了sql-mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,也重启了mysql,select @@sql_mode显示修改成功,但是再次导入数据库时还是报Invalid default value for 'time'错误,有大佬知道怎么解决吗
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-6-27 19:55:56 | 显示全部楼层


贴一下这个保存的地方的语句具体是什么
猜测按你这个time猜测你这个地方可能是使用的timestamp,这个地方不能为空
有可能是需要添加 explicit_defaults_for_timestamp = ON
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2022-6-28 08:39:58 | 显示全部楼层

就是使用的timestamp且不为空  

[mysqld]
port                = 3306
socket                = /tmp/mysql.sock
datadir = /usr/local/mysql/var
skip-external-locking
key_buffer_size = 64M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
net_buffer_length = 8K
read_buffer_size = 1M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 16M
thread_cache_size = 32
query_cache_size = 32M
tmp_table_size = 64M

#skip-networking
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535

log-bin=mysql-bin
binlog_format=mixed
server-id        = 1
expire_logs_days = 10

default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_data_home_dir = /usr/local/mysql/var
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/var
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
sql_mode = ANSI,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
explicit_defaults_for_timestamp = ON

添加explicit_defaults_for_timestamp = ON后
mysql启动不了了
Starting MySQL......Manager of pid-file quit without updati[FAILED] 报这个错误

补充内容 (2022-6-28 09:47):
删除这句就可以正常启动 ,加上就失败
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2022-6-28 12:00:19 | 显示全部楼层



毛毛 发表于 2022-6-28 08:39
就是使用的timestamp且不为空  

[mysqld]

sql_mode不要加,发mysql错误日志
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2022-6-28 14:02:06 | 显示全部楼层

220628 08:10:32 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZuf60e0xat657z99iodokZ.pid ended
220628 09:10:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
220628  9:10:26  InnoDB: Initializing buffer pool, size = 256.0M
220628  9:10:26  InnoDB: Completed initialization of buffer pool
220628  9:10:26  InnoDB: Started; log sequence number 0 721105
220628  9:10:26 [ERROR] /usr/local/mysql/libexec/mysqld: unknown variable 'explicit_defaults_for_timestamp=true'
220628  9:10:26 [ERROR] Aborting

220628  9:10:26  InnoDB: Starting shutdown...
220628  9:10:31  InnoDB: Shutdown completed; log sequence number 0 721105
220628  9:10:31 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

220628 09:10:31 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZuf60e0xat657z99iodokZ.pid ended
220628 13:54:17 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
220628 13:54:17  InnoDB: Initializing buffer pool, size = 256.0M
220628 13:54:17  InnoDB: Completed initialization of buffer pool
220628 13:54:17  InnoDB: Started; log sequence number 0 721105
220628 13:54:17 [ERROR] /usr/local/mysql/libexec/mysqld: unknown variable 'explicit_defaults_for_timestamp=true'
220628 13:54:17 [ERROR] Aborting

220628 13:54:17  InnoDB: Starting shutdown...
220628 13:54:23  InnoDB: Shutdown completed; log sequence number 0 721105
220628 13:54:23 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

220628 13:54:23 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZuf60e0xat657z99iodokZ.pid ended

军哥运维代购:http://shop63846532.taobao.com/

发表于 2022-6-28 19:23:15 | 显示全部楼层

毛毛 发表于 2022-6-28 14:02
220628 08:10:32 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZuf60e0xat657z99iodokZ.pid en ...

前面让你提供的报错语句发一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-24 04:51 , Processed in 0.027319 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表