MySQL修改root密码报错View ‘mysql.user’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
当您在使用 “UPDATE user SET password=PASSWORD(‘newpassword’) WHERE User=‘root’;” 命令时提示 “ERROR 1356 (HY000): View ‘mysql.user’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them”,表明在您的 MariaDB 版本中,‘user’ 表已经不存在,由于版本不同的MariaDB解决方案也不同。
1.如果你的版本在10.4.4以上,你可以使用如下命令重置密码
1 |
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword'; |
2.如果你的版本在10.4.4之前,你可以使用如下命令重置密码
1 |
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword'); |
修改完成之后重启mysql服务,并使用新密码登录MariaDB。