问题描述:
[root@it01 soft]# /mysql/mysql57/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --initialize-insecure --console
Killed
问题分析:
1.查看错误日志,错误日志报错如下:
[root@it01 soft]# more /mysqldata/mysql_3306/log/mysql-error.log
2023-06-09T19:49:59.796928+08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (
see documentation for more details).
2023-06-09T19:49:59.797077+08:00 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2023-06-09T19:51:50.721572+08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (
see documentation for more details).
2023-06-09T19:51:50.721668+08:00 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2023-06-09T19:57:35.348105+08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (
see documentation for more details).
2023-06-09T19:57:35.348180+08:00 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2023-06-09T19:58:23.906629+08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (
see documentation for more details).
2023-06-09T19:58:23.906753+08:00 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2023-06-11T08:52:38.266359+08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (
see documentation for more details).
2023-06-11T08:52:38.266467+08:00 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
问题的原因:
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (
see documentation for more details).
解决方案:
1.在配置文件中加入:
1 [mysqld]
2 # explicit_defaults_for_timestamp
3 explicit_defaults_for_timestamp=true
2.重新初始化并启动数据库
/mysql/mysql57/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --initialize-insecure --console
/mysql/mysql57/bin/mysqld_safe --defaults-file=/etc/my.cnf &
3.这次初始话成功,没有killed,进程可以正常启动使用
参考文档: