How to Connect MySQL to Tableau

Galaxy Glossary

How do I connect a MySQL database to Tableau?

Connect MySQL to Tableau by installing the MySQL driver, entering server credentials, and optionally adding SSL or SSH settings to build visualizations from live or extracted data.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.

Description

Why link MySQL and Tableau?

Tableau cannot visualize MySQL data until a driver is installed and a connection is configured. Linking the two lets analysts build live dashboards or extracts without exporting CSVs.

What credentials does Tableau need?

Tableau Desktop requires the MySQL host, port (default 3306), database name, username, and password. For cloud databases, add the public IP or a tunnel endpoint.

How do I install the MySQL driver?

Download the “MySQL Connector/ODBC” 8.x driver that matches your OS (64-bit for Tableau 2021.4+). Run the installer, then restart Tableau so it detects the driver.

How do I create a MySQL connection in Tableau Desktop?

  1. Open Tableau → ConnectTo a ServerMySQL.
  2. Enter Server, Port, Database, Username, and Password.
  3. (Optional) Tick Require SSL and browse to CA, client cert, and key files.
  4. Click Sign In. Tableau lists schemas and tables for drag-and-drop or Custom SQL.

How to add SSL or SSH tunneling?

For SSL, supply PEM files that match the MySQL server’s --ssl-ca, --ssl-cert, and --ssl-key. For SSH, use a third-party tool (e.g., PuTTY, Cloud SQL Auth proxy) to forward 127.0.0.1:3306 → remote_host:3306, then connect Tableau to localhost.

How to test the connection with Custom SQL?

After connecting, click New Custom SQL and paste a query like:
SELECT c.id, c.name, o.order_date, o.total_amountFROM Customers cJOIN Orders o ON o.customer_id = c.idWHERE o.order_date > CURRENT_DATE - INTERVAL '30' DAY;

If data previews without errors, the connection is stable.

Best practices for performance

  • Use extracts for large tables to offload work from MySQL.
  • Create views in MySQL for complex joins so Tableau only queries a single object.
  • Add proper indexes on Orders.customer_id, OrderItems.order_id, and date columns.

Common pitfalls and fixes

Driver mismatch: Tableau 64-bit cannot load a 32-bit ODBC driver. Reinstall the 64-bit version.

Too many connections: Increase max_connections on the MySQL server or enable Tableau connection pooling.

Troubleshooting tips

Enable Tableau Desktop logging (Help → Settings and Performance → Start Performance Recording) and review the tabprotosrv.txt file for authentication or SSL errors.

Why How to Connect MySQL to Tableau is important

How to Connect MySQL to Tableau Example Usage


-- Show last week's revenue for Tableau dashboard
SELECT DATE(o.order_date) AS order_day,
       SUM(o.total_amount)       AS daily_revenue
FROM Orders o
WHERE o.order_date >= CURRENT_DATE - INTERVAL 7 DAY
GROUP BY DATE(o.order_date)
ORDER BY order_day;

How to Connect MySQL to Tableau Syntax


ODBC DSN (Windows):
Driver={MySQL ODBC 8.1 Unicode Driver};Server=your_host;Port=3306;Database=ecommerce;Uid=your_user;Pwd=your_pass;OPTION=3;

MySQL URI (Tableau Server):
mysql://your_user:your_pass@your_host:3306/ecommerce?ssl-ca=ca.pem&ssl-cert=client-cert.pem&ssl-key=client-key.pem

Custom SQL example for Tableau:
SELECT p.name, p.stock, SUM(oi.quantity) AS total_sold
FROM Products p
JOIN OrderItems oi ON oi.product_id = p.id
GROUP BY p.id, p.name;

Common Mistakes

Frequently Asked Questions (FAQs)

Does Tableau require a MySQL ODBC or JDBC driver?

Tableau Desktop uses the MySQL Connector/ODBC driver on Windows and the built-in driver on macOS. Tableau Server uses a JDBC-compatible driver that it bundles, but updating to the latest version is recommended.

Can I publish a workbook with embedded MySQL creds?

Yes. In Tableau Desktop, select Server → Publish Workbook and choose Embedded password. This lets Tableau Server refresh extracts without prompting for credentials.

How do I refresh MySQL extracts on Tableau Server?

Create an extract in Desktop, publish it, then schedule refreshes in Tableau Server. Ensure the Server “Run As” user has network access to the MySQL host.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.