3

I am trying to connect a MySQL database to Apache Superset but the following error is reported:

sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'supersetuser'@'localhost' (using password: YES)")

I am using MAMP with MySQL running locally on port 8889. I am trying to connect database apache_superset using the credentials of user supersetuser. The SQLAlchemy URI I am trying to pass in Apache Superset looks like the one below:

mysql://supersetuser:superset@localhost:8889/apache_superset

I am quite sure that the credentials are correct since I have just created them. Furthermore, I have also tried to assign the required privileges to the user

GRANT ALL PRIVILEGES ON `apache_superset`.* TO 'supersetuser'@'localhost' WITH GRANT OPTION;

but I am still unable to connect the db to Apache Superset.

4

1 回答 1

5

我设法通过替换找到解决localhost方案127.0.0.1

所以完整的 SQLAlchemy URI 变为:

mysql://supersetuser:superset@127.0.0.1:8889/apache_superset 

根据文档

在 Unix 上,MySQL 程序对主机名 localhost 进行了特殊处理,与其他基于网络的程序相比,这种方式可能与您所期望的不同。对于到 localhost 的连接,MySQL 程序尝试使用 Unix 套接字文件连接到本地服务器。即使给出 --port 或 -P 选项来指定端口号,也会发生这种情况。要确保客户端与本地服务器建立 TCP/IP 连接,请使用 --host 或 -h 指定主机名值 127.0.0.1,或本地服务器的 IP 地址或名称。

于 2018-01-15T10:50:54.027 回答