启动mysql报错原因

systemctl start mysqld
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password:
==== AUTHENTICATION COMPLETE ===
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

然后就根据这个Job for mysqld.service failed because the control process exited with error code错误提示往下查找。
看systemctl status mysqld.service和journalctl -xe都看不出来是什么原因。
接着看日志

2020-08-09T03:07:05.187569Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.21) starting as process 21634
2020-08-09T03:07:05.196583Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2020-08-09T03:07:05.196683Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-08-09T03:07:05.196721Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-08-09T03:07:05.197376Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.21) MySQL Community Server - GPL.

主要发现错误信息是这一条

Failed to find valid data directory