Introducing Flights: agent-native data pipelines in MotherDuckJoin the livestream

Skip to main content

MySQL

MySQL is a relational database commonly used for application data. DuckDB's MySQL extension can read from MySQL-compatible databases, which lets you copy selected data into MotherDuck from a DuckDB client.

How it works with MotherDuck

  1. Connect to MotherDuck from the DuckDB CLI, Python, or another DuckDB client.
  2. Install and load DuckDB's MySQL extension in that session.
  3. Attach the MySQL database, then create MotherDuck tables from selected MySQL tables or queries.

Example

INSTALL mysql;
LOAD mysql;

ATTACH 'host=localhost port=3306 user=my_user password=my_password database=my_database'
AS mysql_db (TYPE mysql);

CREATE TABLE my_table AS
SELECT *
FROM mysql_db.my_schema.my_table;