TransWikia.com

I want to connect a Docker Superset container to an existing external MySQL database

Stack Overflow Asked on December 16, 2021

I am trying to add an existing MySQL database as a source database to a docker container running Apache Superset. The MySQL database that I am trying to add is not running in a docker container. It’s an existing MySQL database running on a Windows machine.

I’ve added mysqlclient==1.4.6 to requirements.txt. The error message seems to indicate that the driver is installed.

I’ve used mysql://user:[email protected]:3306/database_name and mysql://user:password@localhost:3306/database_name

The error I get is:

"ERROR: Connection failed, please check your connection settings."

I am using image: apache / 'incubator-superset' v. 0.36.0

Are there any settings or config that needs to be changed to be able to communicate to an external database from within a running docker container?

Any help would be appreciated!

3 Answers

You should be able to do that but your MySQL has to have external IP that you can access from your Supserset Machine. First do a telnet to see if you can listen from port 3306 to that machine and if you can Supserset should work with very similar URI that you have.

Answered by Eugenia Moreno on December 16, 2021

So I figured it out. For Windows, run ipconfig (maybe ifconfig linux, mac) in terminal/powershell and check what ip address docker ethernet port is using (listed as WSL), let's say ip is: 172.x(x).x(x).x(x). Then configure connection string with ip address on docker ethernet port as follows: 'mysql://user:[email protected](x).x(x).x(x):3306/database_name'.

Follow-up question if anybody knows: How can I connect my docker container running apache/superset to another server/ip address on my local network running a MySQL server? In other words I want to connect the apache/superset app that is running on my computer in a docker container, to another computer on my local network that is running a MySQL server. The MySQL sever is not in a docker container.

Answered by DukeLuke on December 16, 2021

maybe the steps of this blog can help.

If your mysql is in other docker it it is not 127.0.0.1 and in addition if you don't want the requirements to be updated every time that you git pull a new docker, it is better to use the requirements-local.txt

Answered by Eugenia Moreno on December 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP