lnmp1.9安装完成后,mysql导入数据库Invalid default value for 'time'
之前用的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'错误,有大佬知道怎么解决吗贴一下这个保存的地方的语句具体是什么
猜测按你这个time猜测你这个地方可能是使用的timestamp,这个地方不能为空
有可能是需要添加 explicit_defaults_for_timestamp = ON 就是使用的timestamp且不为空
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 报这个错误
补充内容 (2022-6-28 09:47):
删除这句就可以正常启动 ,加上就失败 毛毛 发表于 2022-6-28 08:39
就是使用的timestamp且不为空
sql_mode不要加,发mysql错误日志 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
2206289:10:26InnoDB: Initializing buffer pool, size = 256.0M
2206289:10:26InnoDB: Completed initialization of buffer pool
2206289:10:26InnoDB: Started; log sequence number 0 721105
2206289:10:26 /usr/local/mysql/libexec/mysqld: unknown variable 'explicit_defaults_for_timestamp=true'
2206289:10:26 Aborting
2206289:10:26InnoDB: Starting shutdown...
2206289:10:31InnoDB: Shutdown completed; log sequence number 0 721105
2206289:10:31 /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:17InnoDB: Initializing buffer pool, size = 256.0M
220628 13:54:17InnoDB: Completed initialization of buffer pool
220628 13:54:17InnoDB: Started; log sequence number 0 721105
220628 13:54:17 /usr/local/mysql/libexec/mysqld: unknown variable 'explicit_defaults_for_timestamp=true'
220628 13:54:17 Aborting
220628 13:54:17InnoDB: Starting shutdown...
220628 13:54:23InnoDB: Shutdown completed; log sequence number 0 721105
220628 13:54:23 /usr/local/mysql/libexec/mysqld: Shutdown complete
220628 13:54:23 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZuf60e0xat657z99iodokZ.pid ended 毛毛 发表于 2022-6-28 14:02
220628 08:10:32 mysqld_safe mysqld from pid file /usr/local/mysql/var/iZuf60e0xat657z99iodokZ.pid en ...
前面让你提供的报错语句发一下
页:
[1]