{{tag>mariadb mysql}} ====== mariadb reenable password authentication ====== ===== Debian 10 ===== ==== Disable unix socket authentication ==== update mysql.user set plugin='' where user='root'; flush privileges; ==== Update password ==== update mysql.user set password=password('yourpasswd') where user='root'; or run //mysql_secure_installation// from command line and set password. ==== Check ==== select user,host,password,plugin from mysql.user; MariaDB [(none)]> select user,host,password,plugin from mysql.user; +------+-----------+-------------------------------------------+--------+ | user | host | password | plugin | +------+-----------+-------------------------------------------+--------+ | root | localhost | *C3F43AFF2CF6AACD60EE1AAB1B48ADB3066E0EA4 | | +------+-----------+-------------------------------------------+--------+ ===== Debian 11 ===== This will disable unix socket authentication as well as set the password to 'root': ~# mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD ('root');" ==== Check ==== MariaDB [(none)]> show create user root@localhost; +---------------------------------------------------------------------------------------------------+ | CREATE USER for root@localhost | +---------------------------------------------------------------------------------------------------+ | CREATE USER `root`@`localhost` IDENTIFIED BY PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' | +---------------------------------------------------------------------------------------------------+ 1 row in set (0.001 sec) ====== Tested on ====== * Debian 10.8, 10.3.27-MariaDB-0+deb10u1 * Debian 11. 10.5.12-MariaDB-0+deb11u1 Debian 11 ====== See also ====== * [[Enable pwd auth on mysql 8.0 on CentOS]] ====== References ====== * https://kofler.info/root-login-problem-mit-mariadb/