Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get superset to work with MYSQL #199

Open
saqeria opened this issue Dec 2, 2020 · 5 comments
Open

Can't get superset to work with MYSQL #199

saqeria opened this issue Dec 2, 2020 · 5 comments

Comments

@saqeria
Copy link

saqeria commented Dec 2, 2020

Dear,

I've tried too many methods, different docker repository's and versions but I can't get superset to work with MYSQL. I made a MYSQL container and checked if all the ports and database info is correct. When I try to add the SQLAlchemy URI and test the connection it says the "ERROR: Connection failed, please check your connection settings" error. I've read through the original repository setup/confiquration and I've checked out the examples in this repository, but both options didn't work unfortunately. I'm trying to set up superset in synology docker. If anyone could please help me out it would be very much appreciated, currently I've been searching and trying different things for 4 hours now.. I know this isn't an issue and it's probably an issue on my side, but I'm really trying my best to set it up.

Some info:

  • I didn't load a custom superset_config.py as I've read that it isn't really necessary.
  • I've changed the MYSQL database port to 3309 because port 3306 was already in use by another container.
  • The SQLAlchemy URI (removed personal info): mysql://User:Password@localhost:3309/database

Thanks in advance for your effort.
Help is really much appreciated 😢

@amancevice
Copy link
Owner

if superset and mysql are both running in containers, then you cannot use localhost to access the DB. If you are bringing both containers up via docker-compose then you should be able to reference the container by name. If it helps, you can imagine that your containers are running on completely separate machines in the cloud. If you are using docker-compose you also don't have to worry about colliding ports because you can configure your services to run in the same virtual network.

For example:

version: '3'
services:
  superset:
    image: amancevice/superset
  ports:
    - 8088:8088

  mysql:
    image: mysql

If I bring up these services with docker-compose up --detach I can access the superset instance at http://localhost:8088/ because I have mapped my ports. But to access MySQL from inside the superset container I would use mysql://user:pass@mysql:3306/db because my container is called mysql and Docker automatically allows you to reference containers by their names.

@saqeria
Copy link
Author

saqeria commented Dec 2, 2020

if superset and mysql are both running in containers, then you cannot use localhost to access the DB. If you are bringing both containers up via docker-compose then you should be able to reference the container by name. If it helps, you can imagine that your containers are running on completely separate machines in the cloud. If you are using docker-compose you also don't have to worry about colliding ports because you can configure your services to run in the same virtual network.

For example:

version: '3'
services:
  superset:
    image: amancevice/superset
  ports:
    - 8088:8088

  mysql:
    image: mysql

If I bring up these services with docker-compose up --detach I can access the superset instance at http://localhost:8088/ because I have mapped my ports. But to access MySQL from inside the superset container I would use mysql://user:pass@mysql:3306/db because my container is called mysql and Docker automatically allows you to reference containers by their names.

Thank you for you reaction and effort. I've reproduced the steps that you've explained but without any success unfortunately.

The docker-compose.yml that I've created/used:

version: '3'
services:
  superset:
    image: amancevice/superset
    restart: always
  ports:
    - 8088:8088

  mysql:
    image: mysql
    restart: always
    environment:
      MYSQL_DATABASE: superset
      MYSQL_PASSWORD: PASSWORD
      MYSQL_ROOT_PASSWORD: PASSWORD
      MYSQL_USER: user

Commands that I've run in the docker container terminal after the docker-compose up --detach command:

  • pip install mysqlclient
  • superset db upgrade
  • superset fab create-admin
  • superset load_examples
  • superset init

After this I restarted both containers and tried to connect to MySQL database using mysql://user:PASSWORD@mysql/superset and also mysql://user:PASSWORD@mysql/superset

Thanks again for your effort and help, you can not imagine how happy I'm that you've even responded to me :)

@saqeria
Copy link
Author

saqeria commented Dec 4, 2020

@amancevice ?

@amancevice
Copy link
Owner

sorry, I don't really know what to tell you. I'd focus on figuring out why you can't access your MySQL container from another container in docker-compose. Maybe try setting up two parallel MySQL containers and try connecting to one from the other with the mysql repl. It could be your MySQL config isn't accepting traffic properly.

@saqeria
Copy link
Author

saqeria commented Dec 30, 2020

I am now trying to install the mysql database directly in the container itself but I can't seem to gain root access. What is the root password of the OS? "Su -" asks for a password but I couldn't find the password in the documentation. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants