错误消息:
2024-12-18T09:16:25.285116Z 0 [System] [MY-010116] [Server] /www/server/mysql/bin/mysqld (mysqld 8.0.24) starting as process 967445 2024-12-18T09:16:25.300535Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory. 2024-12-18T09:16:25.300660Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. 2024-12-18T09:16:25.300736Z 0 [ERROR] [MY-010119] [Server] Aborting
修复方案
如何已经排除权限问题则可能是数据目录中的文件损坏或缺失,可以尝试重建数据目录:
备份旧数据目录:
sudo mv /www/server/data /www/server/data.bak
sudo mkdir -p /www/server/data
初始化新的数据目录:
sudo mysqld --initialize --user=mysql --datadir=/www/server/data
重启 MySQL 服务:
sudo systemctl restart mysqld