Bug description
- Env: Python 3.11.13 by conda sys: Ubuntu 22.04 user: root
- Build flow(https://superset.apache.org/docs/installation/pypi):
- sudo apt-get install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev
- pip install apache_superset
- export SUPERSET_SECRET_KEY=< ... > .
- export FLASK_APP=superset
- superset db upgrade
- superset fab create-admin
- superset load_examples
- superset init
- superset run -p 8088 --with-threads --reload --debugger Additional:
- pip install mysqlclient mysql-connector-python
- BUG: When selecting Connect to a Database, neither the optional database icon nor the drop-down box includes MySQL. Connecting via
mysql://: @ / shows connection failure - Solution:
'''bash export LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6 '''
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.11
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
Hi @2308087369! I'm Dosu and I’m helping the superset team.
MySQL is missing from the connection options because, starting with Superset 4.1.0, database drivers like mysqlclient
are no longer bundled by default—you have to install them yourself for MySQL support to appear in the UI. Even though you ran pip install mysqlclient
, in some environments (especially with conda or when running as root), the package may not be visible to the Python interpreter that runs Superset, or system dependencies may be missing or mismatched. This is the most common cause of the missing MySQL icon and dropdown option [1] [2].
Here’s what to check:
- Make sure all required system dependencies are installed:
sudo apt-get install build-essential python3-dev default-libmysqlclient-dev pkg-config
- Reinstall
mysqlclient
in the exact Python environment where Superset runs (activate your conda env if using one):
pip install --force-reinstall --no-cache-dir mysqlclient
- Restart Superset after installation.
- If MySQL still doesn’t appear, check the Superset logs for errors like
No module named 'MySQLdb'
. This indicatesmysqlclient
is still not accessible to Superset [3].
Note: Installing only mysql-connector-python
is not enough—Superset expects the MySQLdb
dialect provided by mysqlclient
for full MySQL support. Using mysql-connector-python
can cause compatibility issues and is not the default or recommended driver [4].
The LD_PRELOAD
workaround is not a standard or documented fix for this issue and is unlikely to help unless you have a very specific library loading problem, which is rare in this context.
If you still don’t see MySQL after these steps, double-check that you’re running Superset in the same environment where you installed mysqlclient
, and share any relevant error logs for further troubleshooting.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Comment From: 2308087369
Thanks @dosu, I mentioned in my description that I pip installed two related dependencies for mysql, but it didn't work. The next step is to set the environment variables LD_PRELOAD make the mysql connection normal