问题:ERROR 1064 (42000): You have an error in your SQL syntax; Want to configure a password as root being the user
在之前我刚下载完MySQL后,root默认密码为空,现在还需要查询log找到密码才能登陆
# grep 'temporary password' /var/log/mysql/mysqld.log
: 后面为初始密码
原先的更改密码指令为
# mysql -uroot -p
# Enter password: 【输入原来的密码】
# mysql>use mysql;
# mysql> update user set password=passworD("test") where user='root';
# mysql> exit;
如果Mysql的版本是5.7及以上的话update语句更换如下:
# mysql> update user set authentication_string=passworD("test") where user='root';
之前都是这里就基本更新好了密码,现在直接报错
ERROR 1064 (42000): You have an error in your SQL syntax; Want to configure a password as root being the user
后面发现这破东西指令又变了!
Mysql的版本是8.0及以上的话update语句更换如下:
# mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';