With MariaDB you can not alter users via user because the later one is a view, not a table; and you will get errors whenever you try to do that.
This is what I ended up, to overcome this issue on Debian 12:
sudo mysql -u root
USE mysql;
GRANT ALL PRIVILEGES ON *.* TO `begueradj`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket WITH GRANT
OPTION ;
Query OK, 0 rows affected (0.004 sec) // result
And I connect successfully:
mysql -u begueradj -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
source
). I suppose now the old users don't have access to the databases. How should I now enable all the old users to have access to the right database? Even I log in as root, and issue the command:SELECT user FROM mysql.user;
it gives the above error. What is the solution? – Wordless