Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MariaDB Warning: 'root@localhost' has both ... The password will be ignored

I have installed MariaDB on Ubuntu LTS 16.04. Then I have run

/usr/bin/mysql_secure_installation

and set a root password. Accessing the DB via mysql -u root -p works fine. But checking the status with service mysql status opens a log file with this warning:

[Warning] 'user' entry 'root@localhost' has both a password and an authentication plugin specified. The password will be ignored.

The questions are:

  1. Is this a worry or completely normal?
  2. If this is a worry, how can I fix it?
like image 825
FlorianL Avatar asked Apr 16 '17 16:04

FlorianL


People also ask

How do I fix access denied for localhost using password no?

mysql> flush privileges; mysql> grant all privileges on *. * to root@localhost identified by 'Password' with grant option; Enter your password in place of Password .

How to fix access denied for user in MySQL?

To resolve the error, you must create a user with the following command: mysql> GRANT ALL ON *. * to user_name@localhost IDENTIFIED BY 'password'; Replace user_name with the user's username and password with the user's password.

How can I access MariaDB without password?

Method 1: Use sudo By default, the local root user can log in to MySQL or MariaDB without password, so you can just use sudo mysql instead of mysql , and expect everything to work. Of course, this depends on your sudo to not ask you for a password, or you'll still have to enter one for the root privilege.


1 Answers

It is normal, if by saying "accessing the DB via mysql -u root -p works fine" you mean that you are running it while being a system root (or under sudo). You should not be able to do it as an ordinary user.

Packages generated by Ubuntu by default have unix_socket authentication for the local root. To check, run

SELECT user, host, plugin FROM mysql.user;

You should see unix_socket in the plugin column for root@localhost.

If you want to use the password authentication instead, run

UPDATE mysql.user SET plugin = '' WHERE plugin = 'unix_socket';
FLUSH PRIVILEGES;
like image 188
elenst Avatar answered Sep 28 '22 12:09

elenst