Failed to find valid data directory.Data Dictionary initialization failed.

启动mysql时出现错误

这句话只要是出错都会报出来,所以不能根据这条语句查百度之类的

Job for mysql.server.service failed because the control process exited with error code. See "systemctl status mysql.server.service" and "journalctl -xe" for details.

敲命令,可以看一下systemctl status mysql.server.service  还有journalctl -xe


错误多种多样 百度了半天也没查到个结果(网上还有说要改MAC的,都不正确)

按照如下进行操作

cat  /etc/my.cnf   看一下错误文件的位置

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

我的路径就是/var/log/mariadb/mariadb.log

继续cat  /var/log/mariadb/mariadb.log 查看真正的错误是什么

出现一下error (你出现错误的也许和我不一样,仔细看看自己报的什么错误,然后再百度或者谷歌)

2018-06-18T03:17:43.045657Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.

2018-06-18T03:17:43.098624Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.11) starting as process 1109
2018-06-18T03:17:44.315384Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2018-06-18T03:17:44.343897Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2018-06-18T03:17:44.343979Z 0 [ERROR] [MY-010119] [Server] Aborting

2018-06-18T03:17:44.444999Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.11)  MySQL Community Server - GPL.

我这个问题的解决方案

https://forums.mysql.com/read.php?11,665874,665886

在 vi /etc/my.cnf  把

#datadir=/var/lib/mysql  注释掉即可

自己昨天凌晨加今天上午找了 4 5个小时的问题没想到只是一句注释的事!!!




猜你喜欢

转载自blog.csdn.net/Wuhaotian1996/article/details/80723539