在Mysql 8.0.19中设置authentication_string

Lok*_*ywa 5 mysql password

尝试重置 root 的密码,我最终得到了这一行:

update user set authentication_string=password('1234') where user='root'
Run Code Online (Sandbox Code Playgroud)

这会导致平均语法错误

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('1234') where user='root''
Run Code Online (Sandbox Code Playgroud)

替换password('1234')'1234'作品,所以看起来“密码”功能丢失了。那么我该如何哈希我的密码呢?

Roy*_*ams 3

使用ALTER_USER而不是SET authentication_string

更改由“1234”标识的用户“root”@“localhost”;