You are using mariadb as an anonymous user

孤街醉人 提交于 2019-12-22 10:04:15

问题


All the privileges have been denied and all my databases seem to have been deleted. I get the error mentioned in the subject when I try to change the password. Initially there was no password set and this behaviour started after executing the following command

update mysql.user set password=password('newpass') where user='root';

I enter mysql using:

mysql -u root

Every command I try to execute gives me access denied error. I tried surfing on google but did not get a solution to solve the issue.


回答1:


You must set the plugin of the user too, and flush privileges everytime

> update mysql.user set password=password('newpass') where user='root';
> flush privileges;
> update mysql.user set plugin='mysql_native_password' where user='root';
> flush privileges;

Then check you are not using an anonymous user when the database instance starts: in your /etc/my.cnf remove/comment any line which looks like this

skip-grant-tables #comment with #

And restart the database

service <db> restart


来源:https://stackoverflow.com/questions/49926467/you-are-using-mariadb-as-an-anonymous-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!