【问题标题】:You are using mariadb as an anonymous user您正在以匿名用户身份使用 mariadb
【发布时间】:2018-09-30 06:36:30
【问题描述】:

所有权限都被拒绝,我所有的数据库似乎都被删除了。当我尝试更改密码时,我收到主题中提到的错误。 最初没有设置密码,执行以下命令后开始出现此行为

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

我输入mysql使用:

mysql -u root

我尝试执行的每个命令都会出现访问被拒绝错误。我尝试在 google 上冲浪,但没有找到解决问题的方法。

【问题讨论】:

    标签: mysql phpmyadmin xampp


    【解决方案1】:

    你也必须设置用户的插件,并且每次都刷新权限

    > 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;
    

    然后在数据库实例启动时检查您是否使用匿名用户:在您的 /etc/my.cnf 中删除/注释任何看起来像这样的行

    skip-grant-tables #comment with #
    

    然后重启数据库

    service <db> restart
    

    【讨论】:

    • 不敢相信 MySQL 文档中没有提到这一点。或者这是 MariaDB 特有的?
    • 救命建议先生!!! “newpass”是你自己的密码,但插件“mysql_native_password”是一个硬编码的插件,不能更改。最重要的是,您必须突出显示所有这些都以非 root 用户 id 执行,运行命令“mysql -u root -p”。
    • 您使用命令 'update mysql.user set plugin='mysql_native_password' where user='root';' 为我节省了一天的时间
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-03
    • 2014-08-09
    相关资源
    最近更新 更多