命令: mysqld --initialize
报错
[ERROR] [MY-010172] [Server] failed to set datadir to /data/server/mysql/data/
报错:Failed to find valid data directory.
Data Dictionary initialization failed
解决:
-
可能是存放数据的磁盘空间不足
-
切换命令:mysqld --initialize --user=mysql
-
初始化的时候没有指定配置文件,就初始化数据到默认目录: /var/lib/mysql 了,启动的时候又使用了自定义的配置文件,也有可能导致
指定配置文件:
mysqld --defaults-file=/data/server/mysql/my.cnf --user=mysql --initialize
或者初始化数据目录
mysqld --initialize --console --datadir=/data/mysql/data --user=mysql
报错
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决:alter user user() identified by "123456"; // 修改密码后解决
报错
命令:
$ ./bin/mysqld --defaults-file=/data/mysql/my.cnf --user=mysql --initialize
./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解决:
yum install -y libaio