How to Connect MySQL to Looker

Galaxy Glossary

How do I connect a MySQL database to Looker?

Create a secure JDBC connection so Looker can query your MySQL database in real time.

Sign up for the latest in SQL knowledge from the Galaxy Team!

Description

Why connect MySQL to Looker?

Looker needs a live database connection to generate SQL, build Explores, and surface dashboards. Connecting MySQL lets teams analyze transactional data—orders, customers, products—without ETL.

What prerequisites do I need?

Ensure the MySQL instance is reachable from Looker’s IPs, grant a read-only user, and enable SSL if required by your security policy.

How do I create a MySQL connection in Looker?

Step-by-step UI walkthrough

1. Admin → Connections → New Connection
2. Choose “MySQL”.
3. Fill host, port, database, username, password.
4.Toggle SSL if used.
5. Click “Test” then “Add Connection”.

Required JDBC parameters

Add useCursorFetch=true for large result sets and zeroDateTimeBehavior=convertToNull if your schema has 0000-00-00 dates.

How to verify the connection works?

Open SQL Runner, pick your new connection, run SHOW TABLES. Seeing Customers, Orders, Products, and OrderItems confirms access.

How to model ecommerce data after connecting?

Sample Explore from Orders and Customers

Create a view for each table, then use explore: orders and join: customers with sql_on: ${orders.customer_id} = ${customers.id}.Users can now slice revenue by customer attributes.

Best practices for performance

Index foreign keys (Orders.customer_id, OrderItems.order_id), upgrade to MySQL 8+, and limit Explores with persistent_derived_tables to pre-aggregate.

Common mistakes & fixes

Incorrect timezone: Set default_timezone: "UTC" to prevent shifted timestamps.
Missing privileges: Grant SELECT on all schemas you intend to model; Looker fails silently if tables aren’t visible.

.

Why How to Connect MySQL to Looker is important

How to Connect MySQL to Looker Example Usage


SELECT
  c.id,
  c.name,
  COUNT(o.id)           AS total_orders,
  SUM(o.total_amount)   AS lifetime_value
FROM Customers c
LEFT JOIN Orders o ON o.customer_id = c.id
GROUP BY c.id, c.name
ORDER BY lifetime_value DESC
LIMIT 10;

How to Connect MySQL to Looker Syntax


CONNECTION_NAME:
  type: "mysql"
  host: "db.mycompany.com"
  port: 3306
  database: "ecommerce"
  username: "looker_ro"
  password: "********"
  ssl: true
  jdbc_parameters: "useCursorFetch=true&zeroDateTimeBehavior=convertToNull"
  default_timezone: "UTC"
  sql_runner_writes: no

Common Mistakes

Frequently Asked Questions (FAQs)

Does Looker support MySQL 8?

Yes. Make sure the JDBC driver version matches MySQL 8 and enable caching_sha2_password if using the new auth plugin.

Can I write back to MySQL from Looker?

Only via SQL Runner when sql_runner_writes is set to yes. Regular Explores are read-only.

How do I switch from MySQL to Amazon Aurora?

Aurora uses the same MySQL driver, so update the host and replicate connection settings. Re-test and rebuild PDTs.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie
BauHealth Logo
Truvideo Logo