CentOS7.0中安装启动mysql报错

出现图中错误;解决办法:删除   /var/lib/mysql/  然后再启动服务就可以了

CentOS7.0中安装启动mysql报错

登录mysql时又出现错误:

CentOS7.0中安装启动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就可以了

CentOS7.0中安装启动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密码,使用设置的密码登录就好了。

相关文章:

  • 2021-10-09
  • 2021-08-28
  • 2021-07-24
  • 2022-12-23
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2021-11-25
  • 2022-02-10
  • 2021-12-13
  • 2021-07-30
  • 2022-01-15
  • 2022-12-23
相关资源
相似解决方案