Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uberswe/multiquery
A simple tool to run MySQL queries on multiple databases and return the results.
https://github.com/uberswe/multiquery
mariadb mysql query ssh
Last synced: 1 day ago
JSON representation
A simple tool to run MySQL queries on multiple databases and return the results.
- Host: GitHub
- URL: https://github.com/uberswe/multiquery
- Owner: uberswe
- License: mit
- Created: 2020-04-26T21:03:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-08T16:33:59.000Z (over 4 years ago)
- Last Synced: 2024-10-30T05:26:06.442Z (4 months ago)
- Topics: mariadb, mysql, query, ssh
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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.
```bash
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
```bash
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
```bash
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.