错误信息
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
错误复现
mysql> update user set password='' where user = 'root' and host='localhost';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决方法
因为初始化创建数据库的时候,系统会指定一个初始密码。需要修改这个初始密码后,才能正常使用。
注意:如果密码不复杂的话,还会报1819错误。
# 重设密码
SET password=password("xxxxxxxxx");