After a fresh installation of MariaDB, the system's user root
is able to connect as root without password with :
sudo mysql -u root
After reimporting my backup, I can't do this anymore :
user@server:~$ sudo mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Table mysql.user
contains :
MariaDB [mysql]> select host, user, password, plugin from mysql.user;
+-----------+------------+-------------------------------------------+-----------------------+
| host | user | password | plugin |
+-----------+------------+-------------------------------------------+-----------------------+
| localhost | root | | mysql_native_password |
| localhost | phpmyadmin | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| % | user1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| localhost | seafile | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| localhost | gogs | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| localhost | user2 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
| localhost | freshrss | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
+-----------+------------+-------------------------------------------+-----------------------+
7 rows in set (0,001 sec)
How can I get back this behaviour ?
I'm using mariadb 10.5 and Debian 11.
Thanks