--initialize specified but the data directory has files in it. Aborting.

mysql初始化失败,报错如下:

2020-10-13T02:25:14.883062Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2020-10-13T02:25:14.883092Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2020-10-13T02:25:14.883143Z 0 [ERROR] [MY-010119] [Server] Aborting

 

 

解决:
 

cd /var/lib/mysql

rm -rf *

完成后重新初始化

/usr/sbin/mysqld --initialize --user=mysql

初始化完成会在页面打印密码,如果没有请在/var/log/mysql/mysqld.log中获取密码

登陆之前记得先启动服务:

systemctl start mysqld

登陆mysql:

mysql -uroot -p

修改密码:

alter user 'root'@'localhost' identified by 'new-passwd';

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值