Tag Archives: Ubuntu mariadb root access denied

[Solved] Ubuntu mariadb root access denied after mysql_secure_installation

ubuntu mariadb mysql root access denied after mysql_secure_installation

mariadb-cannot-login-as-root

https://stackoverflow.com/questions/43379892/mariadb-cannot-login-as-root

exec command (need no password) :sudo mysql

Unlike native MariaDB packages (those provided by MariaDB itself), packages generated by Ubuntu by default haveunix_socketauthentication for the local root. To check, run

SELECT user, host, plugin FROM mysql.user;

If you seeunix_socketin theplugincolumn, that’s the reason.

To return to the usual password authentication, run

UPDATE mysql.user SET plugin = ” WHERE plugin = ‘unix_socket’; FLUSH PRIVILEGES;

(choose theWHEREclause which fits your purposes, the one above is just an example)