CentOS7.0中安装启动mysql报错
出现图中错误;解决办法:删除 /var/lib/mysql/ 然后再启动服务就可以了
登录mysql时又出现错误:
解决办法:
1.停止mysql服务
systemctl stop mysqld.service
2.修改配置文件无密码登录
vim /etc/my.cnf
在最后加上
skip-grant-tables
保存
3.启动mysql
systemctl start mysqld.service
4.登录mysql
mysql -u root
注意这里不要加-p
5.修改密码,mysql5.7用此语法
use mysql;
update mysql.user set authentication_string=password('123456') where user='root' ;
flush privileges;
6.回到第二部把刚加的那句删掉
保存,重启mysql就可以了
set global validate_password_policy=0;
set global validate_password_length=4;
set password=password('your password');
grant all privileges on *.* to [email protected]'%'identified by 'password';
这时就已经修改了mysql密码,使用设置的密码登录就好了。