由于需要定期修改数据库密码,就着手操作,一开始想当然的写下了SQL:
update mysql.user set password='newpassword' where user='username';
结果提示没有password字段,原来5.7密码改用authentication_string存储密码,然后就修改为:
update mysql.user set authentication_string='newpassword' where user='username';
然而存储的密码是明文,仔细一看脚本,没有把密码串转成密码格式
最终:
update mysql.user set authentication_string=PASSWORD('newpassword') where user='username';