将 MySQL 数据库连接到 Apache Superset
Connecting a MySQL database to Apache Superset
我正在尝试将 MySQL 数据库连接到 Apache Superset,但报告了以下错误:
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'supersetuser'@'localhost' (using password: YES)")
我在本地端口 8889 上将 MAMP 与 MySQL 运行 一起使用。我正在尝试使用用户 supersetuser
的凭据连接数据库 apache_superset
。
我试图在 Apache Superset 中传递的 SQLAlchemy
URI 如下所示:
mysql://supersetuser:superset@localhost:8889/apache_superset
我很确定凭据是正确的,因为我刚刚创建了它们。
此外,我还尝试将所需的权限分配给用户
GRANT ALL PRIVILEGES ON `apache_superset`.* TO 'supersetuser'@'localhost' WITH GRANT OPTION;
但我仍然无法将数据库连接到 Apache Superset。
我设法通过将 localhost
替换为 127.0.0.1
找到了解决方案
因此完整的 SQLAlchemy URI 变为:
mysql://supersetuser:superset@127.0.0.1:8889/apache_superset
根据 documentation:
On Unix, MySQL programs treat the host name localhost specially, in a
way that is likely different from what you expect compared to other
network-based programs. For connections to localhost, MySQL programs
attempt to connect to the local server by using a Unix socket file.
This occurs even if a --port or -P option is given to specify a port
number. To ensure that the client makes a TCP/IP connection to the
local server, use --host or -h to specify a host name value of
127.0.0.1, or the IP address or name of the local server.
我正在尝试将 MySQL 数据库连接到 Apache Superset,但报告了以下错误:
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'supersetuser'@'localhost' (using password: YES)")
我在本地端口 8889 上将 MAMP 与 MySQL 运行 一起使用。我正在尝试使用用户 supersetuser
的凭据连接数据库 apache_superset
。
我试图在 Apache Superset 中传递的 SQLAlchemy
URI 如下所示:
mysql://supersetuser:superset@localhost:8889/apache_superset
我很确定凭据是正确的,因为我刚刚创建了它们。 此外,我还尝试将所需的权限分配给用户
GRANT ALL PRIVILEGES ON `apache_superset`.* TO 'supersetuser'@'localhost' WITH GRANT OPTION;
但我仍然无法将数据库连接到 Apache Superset。
我设法通过将 localhost
替换为 127.0.0.1
因此完整的 SQLAlchemy URI 变为:
mysql://supersetuser:superset@127.0.0.1:8889/apache_superset
根据 documentation:
On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file. This occurs even if a --port or -P option is given to specify a port number. To ensure that the client makes a TCP/IP connection to the local server, use --host or -h to specify a host name value of 127.0.0.1, or the IP address or name of the local server.