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

前端 未结 1 748
予麋鹿
予麋鹿 2021-02-14 07:15

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

相关标签:
1条回答
  • 2021-02-14 08:01

    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;
    
    0 讨论(0)
提交回复
热议问题