zoukankan      html  css  js  c++  java
  • ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'ambari'

    配置Ambari远程maridb 报错:

    ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'ambari'

    在环境搭建的过程中,在

    #Ambari用户(上面设置的用户)登录mysql (没有密码)

    mysql -u ambari -p

    use ambari

    source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql

    遇到了:

    ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'ambari'

    背景:因为之前安装过Mysql,又把mysql卸载了,然后又安装的mariadb

    初步判断,可能是没有创建databases,或者密码错了,或者没有配置mariadb 远程连接的等配置信息(my.cnf)

    按照思路逻辑,来验证第一个问题:

    换成root用户,尝试登陆,查看是否有ambari database

    [root@n1 ~]# mysql -uroot –proot

    MariaDB [(none)]> show databases;

    +--------------------+

    | Database           |

    +--------------------+

    | activity           |

    | ambari             |

    | amon               |

    | cm                 |

    | hive               |

    | hueDEFAULT         |

    | information_schema |

    | mysql              |

    | oozie              |

    | oozieDEFAULT       |

    | performance_schema |

    | python             |

    +--------------------+

    如上述所示,是有ambari数据库的。

    面对第二个问题,我的解决方案是:

    mysql -uambari –p

    直接敲回车,没有密码:

    显示:

    MariaDB [(none)]> show databases;

    +--------------------+

    | Database           |

    +--------------------+

    | information_schema |

    +--------------------+

    1 row in set (0.00 sec)

    如上都不是解决问题的答案:

    最终解决方案:花了1个小时48分钟,解决如上的BUG.

    正确的思路:是权限问题。

    root权限登陆mariadb

    MariaDB [(none)]>  SELECT host,user,password,Grant_priv,Super_priv FROM mysql.user;

    +-----------+--------+-------------------------------------------+------------+------------+

    | host      | user   | password                                  | Grant_priv | Super_priv |

    +-----------+--------+-------------------------------------------+------------+------------+

    | localhost | root   | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | Y          | Y          |

    | 127.0.0.1 | root   | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | Y          | Y          |

    | ::1       | root   | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | Y          | Y          |

    | %         | ambari | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | Y          | Y          |

    | %         | hive   | *6B992DD2D480F43212F044AB3ECAF17E1EA056B9 | N          | Y          |

    | %         | oozie  | *2F2E0D3AD70093DDB3F8964E3984EA04B40A6D3C | N          | Y          |

    +-----------+--------+-------------------------------------------+------------+------------+

    6 rows in set (0.00 sec)

     

    此时ambari用户的Grant_priv的权限为N(图上是Y是因为修改后的解决方案)

    输入sql:

    UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='ambari';

    然后用ambari用户登陆,输入密码成功。

  • 相关阅读:
    Don‘t Cry for Me, Argentina
    对象池
    拒绝高姿态
    SOS: How to popup a HwndSource on topmost
    关于设计和设计文档的2个补充
    从今天开始写博客
    Kafka+Storm写入Hbase和HDFS
    工作流调度引擎Oozie
    showModalDialog在父窗体和子窗体之间传值
    慢说HttpContext
  • 原文地址:https://www.cnblogs.com/lingluo2017/p/8719713.html
Copyright © 2011-2022 走看看