1

Good day,

I logged into mariadb with the skip grant tables option. Then I set password for the localhost root user. Then I flushed the privileges. However, I can still log in with the following command.

mysql -uroot

This is my version of MariaDb.

Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

  • Have you terminated the process that runs with --skip-grant-tables. Just in case, terminate all mysql/mariadb processes, restart the service and try again. As which user to you run mysql -u root? – Daniel Nov 29 '16 at 10:43
  • Yes. When I query for the root record in the mysql.user table, the password column has a value, but I can still log in without it. – Jon Abaca Nov 29 '16 at 10:52
2

You are apparently running mysql -uroot under root system account.

10.0.27-MariaDB-0ubuntu0.16.04.1 is a package provided by Ubuntu. Recently they switched to the Unix socket authentication for the local root account by default. If you run

MariaDB [(none)]> select user, host, password, plugin from mysql.user;

you should see something like this:

MariaDB [(none)]> select user, host, password, plugin from mysql.user;
+------+-----------+-------------------------------------------+-------------+
| user | host      | password                                  | plugin      |
+------+-----------+-------------------------------------------+-------------+
| root | localhost | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 | unix_socket |
+------+-----------+-------------------------------------------+-------------+
1 row in set (0.00 sec)

Naturally, if you don't want it, you can remove unix_socket from the plugin field, flush privileges, then it should work as before.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.