PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 3, 2022

[FIXED] Connecting a MySQL database to Apache Superset

 February 03, 2022     apache-superset, mamp, mysql, sqlalchemy     No comments   

Issue

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.


Solution

I managed to find the solution by replacing localhost with 127.0.0.1

So the complete SQLAlchemy URI becomes:

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

According to the 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.



Answered By - Giorgos Myrianthous
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing