Skip to main content

Connects to a MySQL database and exports selected data to JSON.

Project description

Connects to a MySQL database and exports selected data to JSON.

## Usage
mysql-to-json [-h] [-d DATABASE] [-H HOSTNAME] [-P PORT] [-u USER] [-p]
[-e QUERY]

optional arguments:
-h, --help show this help message and exit
-d DATABASE, --database DATABASE
MySQL database name.
MySQL host name.
-P PORT, --port PORT MySQL port number.
-u USER, --user USER MySQL username.
-p, --password Shh! It's a secret.
-e QUERY, --query QUERY
Query to run.

## Examples

All examples simple select all table information from `information_schema` and save it to `tables.json`

### Simple

This assumes we have full access to the mysql database from localhost.

$> mysql-to-json -e 'SELECT * FROM information_schema.tables' > tables.json

### Medium Complexity

This explicitly sets a user and asks for a password, while still connecting to localhost.

$> mysql-to-json -d mysql -u seth -p -e 'SELECT * FROM information_schema.tables' > tables.json

### All The Things!

This explicitly sets every command line option available.

$> mysql-to-json -h -P 3306 -d mysql -u seth -p -e 'SELECT * FROM information_schema.tables' > tables.json

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mysql-to-json-1.0.0.tar.gz (2.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page