Skip to main content

MySQL

Extract MySQL metadata into Catalog using the castor-extractor package.

Prerequisites

Follow the castor-extractor installation instructions before running the extraction.

We strongly recommend creating a dedicated user to extract your metadata.

Run Extraction Script

Once the package has been installed, you should be able to run the following command in your terminal:

castor-extract-mysql [arguments]

The script will run and display logs as following:

INFO - Extracting `DATABASE` ...
INFO - Extracting database: query 1/1
INFO - Results stored to /tmp/mysql/1706004977-database.csv
...

INFO - Extracting `USER` ...
INFO - Extracting user: query 1/1
INFO - Results stored to /tmp/mysql/1706004977-user.csv

INFO - Wrote output file: /tmp/mysql/1706004977-summary.json

Credentials

  • -H, --host: hostname
  • -P, --port: port number
  • -u, --user: user
  • -p, --password: password

Other Arguments

  • -o, --output: target folder to store the extracted files

Optional Arguments

  • --skip-existing: Skip files already extracted instead of replacing them
Help

You can also get help with the --help argument.

Use ENV Variables

If you don't want to specify arguments every time, you can set the following ENV in your .bashrc:

export CASTOR_MYSQL_HOST=127.0.0.0
export CASTOR_MYSQL_PORT=3306
export CASTOR_MYSQL_USER=extraction_user
export CASTOR_MYSQL_PASSWORD=******

export CASTOR_OUTPUT_DIRECTORY="/tmp/catalog"

Then the script can be executed without any arguments:

castor-extract-mysql

It can also be executed with partial arguments (the script looks in your ENV as a fallback):

castor-extract-mysql --output /tmp/catalog