解决SQL不能修改初始化密码的问题
最近安装了mysql,在使用“ set password for [email protected]=password('123456');”时会遇到
“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 'password('123456')' at line 1”的错误提示。
此外,还有使用以下语句修改初始密码时出现的错误提示:
“select User, Password from mysql.user;”
导致这些错误出现的原因是mysql的版本问题,我使用的是mysql8.0.11版本,解决该问题使用的语句是:
“ ALTER USER 'root'@'localhost' identified by '123456' ; ”
之后刷新再重新用新的密码登陆即可。