Restore root login via 'sudo mariadb' command

After mysql_secure_installation, sudo mariadb command does not seem to work anymore with the following error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Does anyone know how to restore the login via sudo mariadb command?

Version Info
  • MariaDB: 10.3.32
  • Ubuntu: 20.04.1

Thanks!

1 Answer

Well, I needed to switch from password-based authentication to unix-socket authentication.

I ran this command to change the authentication method for my root user.

alter user 'root'@'localhost' identified via unix_socket;

References:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like