解决MySQL修改密码提示Unknown column 'password' in 'field list'

本文详细介绍了在MySQL5.7中如何修改用户密码,包括使用authentication_string字段替代旧版password字段的方法,以及通过配置文件跳过权限表检查来临时登录数据库进行密码更新的具体步骤。

MySQL5.7已经没有password这个字段了,改成了authentication_string

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

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

1.vim /etc/my.cnf [mysqld]段增加skip-grant-tables

2./etc/init.d/mysqld restart

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

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

5.flush privileges;  #立即生效

6.quit;

7.编辑/etc/my.cnf 删掉skip-grant-tables, 然后重启MySQL /etc/init.d/mysqld restart

8.mysql -u root -p 然后输入密码即可登录MySQL数据库

旧版改密码的命令如下,MySQL5.7 password改成了authentication_string

mysql> update user set password=password(“新密码”) where user=”用户名”;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值