2

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?

MiraiTech
  • 43
  • 4

2 Answers2

2

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/

Ramon de la Fuente
  • 8,044
  • 3
  • 32
  • 31
  • Thanks your answer. If I turn off the setting, can I use it as before? – MiraiTech Jul 20 '20 at 04:53
  • It is set as above and it looks like mysql_native_password on the table, but it still happens to be logged in. – MiraiTech Jul 20 '20 at 04:59
  • 1
    I tried query : `ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("password");` It works as intended. Thank you for your answer. – MiraiTech Jul 20 '20 at 06:07
0

Just changing the plugin is not enough. For me it worked with:

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("password");
n3rvio
  • 9
  • 2