mysqld_safe无法启动没有日志
问题登场
[root@binggong ~]# mysqld_safe &
[1] 1474
[root@binggong ~]# 2023-04-11T06:01:58.900294Z mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
2023-04-11T06:01:58.926331Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2023-04-11T06:01:59.135095Z mysqld_safe mysqld from pid file /var/log/mariadb/mariadb.pid ended
[1]+ Done mysqld_safe
[root@binggong ~]#
[root@binggong ~]# cat /var/log/mariadb/mariadb.log
[root@binggong ~]#
如上,mysql 启动失败,且没有日志。。。
各种排查,找不到原因,挺苦恼的。。。
最终,灵光一闪
不用mysqld_safe 启动如何?
[root@binggong bin]# ./mysqld --user=mysql --datadir=/var/lib/mysql --basedir=/usr/local/mysql-5.7.32
2023-04-11T06:31:02.088219Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-04-11T06:31:02.088378Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2023-04-11T06:31:02.088429Z 0 [Note] ./mysqld (mysqld 5.7.32-log) starting as process 1858 ...
2023-04-11T06:31:02.092014Z 0 [ERROR] You have enabled the binary log, but you haven't provided the mandatory server-id. Please refer to the proper server start-up parameters documentation
2023-04-11T06:31:02.092051Z 0 [ERROR] Aborting
2023-04-11T06:31:02.092075Z 0 [Note] Binlog end
2023-04-11T06:31:02.092240Z 0 [Note] ./mysqld: Shutdown complete
[root@binggong bin]#
问题现出原形,多亏了日志!
这里的原因是开启了 binary log,但没有配置server-id,关闭bin log 或者配置server-id 即可
读者根据具体日志抛出的原因 具体处理即可。