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

在新安装的MySQL5.7中遇到密码更改错误,原因为`password`字段已被替换为`authentication_string`。正确更改密码的SQL语句应为`update mysql.user set authentication_string=password('root') where user='root';`。完整步骤包括编辑`my.cnf`文件,添加`skip-grant-tables`,重启MySQL,使用免密码登录修改密码,再删除`skip-grant-tables`并重启,最后通过新密码登录。

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

新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user  set password=password('root') where user='root'时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list',原来是mysql数据库下已经没有password这个字段了,password字段改成了
authentication_string
所以更改语句替换为

update mysql.user set authentication_string=password('root') where user='root' ;

即可

我的系统版本如下:

完整的更改MySQL密码的方式如下:

1、vim /etc/my.cnf 加入skip-grant-tables

2、重启MySQL, /etc/init.d/mysqld restart

3、终端输入 mysql 直接登录MySQL数据库,然后use mysql

4、update mysql.user set authentication_string=password('root') where user='root' ;

mysql5.7更改密码应该采用命令 ALTER USER 'root'@'localhost'IDENTIFIED BY '********'其中密

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

neo_will_mvp

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值