{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Integrations","type":"markdown"},"seo":{"title":"Legacy Bulk Import From Mysql","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"legacy-bulk-import-from-mysql","__idx":0},"children":["Legacy Bulk Import From Mysql"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This article explains how to import data from MySQL to Treasure Data."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"install-legacy-bulk-import","__idx":1},"children":["Install Legacy Bulk Import"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["First, install the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/"},"children":["Toolbelt"]},", which includes a bulk loader program, on your computer."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"downloads","__idx":2},"children":["Downloads"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/win"},"children":["Toolbelt Installer for Windows"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/mac"},"children":["Toolbelt Installer for Mac OS X"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/tools/cli-and-sdks/quickstart"},"children":["Toolbelt Installer for Linux"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After the installation, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td"]}," command is installed on your computer."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Open the terminal and type ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td"]}," to execute the command."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make sure you have J",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ava"]}," as well."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Execute ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td import:jar_update"]}," to download the up-to-date version of our bulk loader:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td\nusage: td [options] COMMAND [args]\n$ java\nUsage: java [-options] class [args...]\n$ td import:jar_update\nInstalled td-import.jar 0.x.xx into /path/to/.td/java\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"importing-data-from-mysql","__idx":3},"children":["Importing data from MySQL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Run the following commands to upload data from MySQL."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td db:create my_db\n$ td table:create my_db my_tbl\n$ td import:auto \\\n  --auto-create my_db.my_tbl \\\n  --format mysql \\\n  --db-url jdbc:mysql://my_sql_host/my_sql_db \\\n  --db-user my_user \\\n  --db-password my_pass \\\n  --time-column date_time \\\n  my_sql_tbl\n"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Because ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td import:auto"]}," executes MapReduce jobs to check the invalid rows, it'll take at least ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1-2 minutes"]},"."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this example, we assumed that:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["the bulk import reads the input data from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_sql_tbl"]}," on the MySQL database specified by the ‘",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--db-"]},"’ prefixed options"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["the bulk import session is created automatically by our request using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--auto-create"]}," option.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"When using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--auto-create"]}," option you must provide the database and table name in the format indicated. The session name will be ‘",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["my_db.my_tbl"]},"’.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"Alternatively, you can create the bulk import session with a name of choice, using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td import:create"]}," command (for details see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/int/legacy-bulk-import-internals"},"children":["Bulk Import Internals, Import Step-by-Step"]},")."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["the time field is called “date_time” and is provided with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--time-column"]}," option"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use the following options to specify the access to the MySQL database:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"MySQL specific options:\n--db-url URL                     JDBC connection URL\n--db-user NAME                   user name for MySQL account\n--db-password PASSWORD           password for MySQL account\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For further details, check the following pages:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/int/legacy-bulk-import-internals"},"children":["Bulk Import Internals"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/int/legacy-bulk-import-tips-and-tricks"},"children":["Bulk Import Tips and Tricks"]}]}]}]},"headings":[{"value":"Legacy Bulk Import From Mysql","id":"legacy-bulk-import-from-mysql","depth":1},{"value":"Install Legacy Bulk Import","id":"install-legacy-bulk-import","depth":1},{"value":"Downloads","id":"downloads","depth":2},{"value":"Importing data from MySQL","id":"importing-data-from-mysql","depth":2}],"frontmatter":{"seo":{"title":"Legacy Bulk Import From Mysql"}},"lastModified":"2026-03-10T06:17:28.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/int/legacy-bulk-import-from-mysql","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}