multiquery

command module
v0.0.0-...-6e549ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2020 License: MIT Imports: 1 Imported by: 0

README

MultiQuery (mq)

A simple cli tool written in Go to query multiple MySQL databases.

Sometimes I have the need to query multiple MySQL databases with the same structure. So I built this simple tool to allow me to do just that. You can connect to a mysql host directly or via an SSH tunnel.

The following query will find all the databases with the prefix wp_ and run a select query on each database and aggregate the results.

mq --host=localhost --dbprefix=wp_ --query="SELECT * FROM wp_users"

This query will ssh to another host and then connect via mysql and run the queries on individual threads

mq --host=10.10.10.100 --query="SELECT * FROM wp_users" --sshhost=wpserver --user=wp --password=[omitted] --threaded --dbprefix=wp_

Use the help command to read about the other parameters that are supported

mq --help

This tool should have no bugs but use it at your own risk. If you are concerned please review my code and feel free to fork the repository to make your own changes. Feel free to open a pull request if you would like to contribute improvements to the code.

You can also use the --threaded option to run concurrent queries.

SSH tunneling is supported if you specify an SSH host.

This tool tries to read ssh config files and my.cnf files when possible.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL