Cent OS 7安装mysql遇到的问题

本文介绍MySQL5.7版本中密码重置的方法及遇到的常见错误处理方式,包括通过修改配置文件绕过密码登录、更新用户认证字符串以重置密码的过程,并涉及如何调整密码策略以符合系统要求,最后还提到了用户权限的授予。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、找不到文件路径时,使用whereis ***;

2、MySQL5.7更改密码时出现ERROR 1054 (42S22): Unknown column 'password' in 'field list'

使用命令:update user set mysql.authentication_string=123456 where user="root";

3、5.7.21 MySQL修改密码步骤:

 1)vim /etc/my.cnf 在[mysqld]后添加skip-grant-tables绕过密码

 2)重启:service mysqld restart

3)进入:$ mysql

4)use mysql;

 update user set authentication_string=PASSWORD("123456") where User='root';

update user set plugin="mysql_native_password" where User='root';

flush privileges;

quit

5)vim /etc/my.cnf 还原配置

6)重启:service mysqld restart

7)进入:mysql -uroot -p

Enter password: 

使用新密码,即可登录


4、修改密码时:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 解决方法:mysql -u root -p#登录
 mysql>set global validate_password_policy=0;#密码强度设为最低等级
 mysql>set global validate_password_length=4;#密码允许最小长度为4
 mysql>flush privileges; #更新授权表,生效

 5、授权:

grant all privileges on *.* to 'root'@'%' identified by '123456'  with grant option;

6、重启生效:

systemctl restart mysqld




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值