mysqlmariadb

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


I have tried query but there is an error.
Does anybody solved the error?

MariaDB [mysql]> UPDATE user SET Host='%' 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

Solution

  • In MariaDB-10.4+, mysql.user is a view rather than a table.

    It's recommended to stop copying off old blogs to do any authentication related changes in MySQL and MariaDB as the mechanisms are being updated and the older solutions may no longer apply. Always check the official documentation.

    Use SET PASSWORD or ALTER USER to manage user authentication.

    Also modifying a user/host component of the username will put triggers, events, plugins, grants, roles etc. out of sync with the combined username (aka broken). So just DROP/CREATE users rather than manipulate them.