1、问题
我的mysql的启动命令:/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
启动的时候是失败了,报错:Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
[root@ecs-c6s-large-2-linux-20210516162055 ~]# /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
2025-06-17T10:38:54.565980Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2025-06-17T10:38:54.567996Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.44) starting as process 4849 ...
2025-06-17T10:38:54.569254Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2025-06-17T10:38:54.569284Z 0 [ERROR] Aborting
2025-06-17T10:38:54.569325Z 0 [Note] Binlog end
Initialization of mysqld failed: 0
2025-06-17T10:38:54.569523Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
[root@ecs-c6s-large-2-linux-20210516162055 ~]#
2、解决方式
用户权限问题,使用root用户,启动命令上加上--user=root
/usr/sbin/mysqld --user=root --daemonize --pid-file=/var/run/mysqld/mysqld.pid