mariadbmariadb-10.4mariadb-10.5

MariaDB root login problem. (can login but, not security)


I have some problem.

Install MariaDB success.

mysql_secure_installation setting complete.

but I login mysql -u root -p

Insert Any password can login on linux root user.

(not root user has to enter the correct password)


This problem does not occur in MariaDB v10.3

but MariaDB v10.4 Over version.


I think this situation is not security.

Can I find some solution?


Solution

  • This is due to the Plugin for the root user set to unix_socket.

    MariaDB [(none)]> select User,Host,Password,Plugin from mysql.user;
    +---------------+-----------+-------------------------------------------+-------------+
    | User          | Host      | Password                                  | Plugin      |
    +---------------+-----------+-------------------------------------------+-------------+
    | root          | localhost | *XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | unix_socket |
    

    You can still turn it off:

    ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;

    Documentation here: https://mariadb.com/kb/en/authentication-plugin-unix-socket/