😎An out-of-the-box mysql proxy written by golang.
This is a proxy for MySQL RDBMS with web GUI. It will show you what's happening under the hood of your database layer. As it sits between your application and MySQL server there's no need to use tools like Wireshark or enable general logs to see which queries are being executed. It comes as single binary with zero dependencies and consists of 2 parts: proxy server and embedded GUI.
Select db | Query list | Freezed query | Query error | In app results |
---|---|---|---|---|
- See all queries sent from your application to MySQL grouped by connection it belongs to.
- Track query execution result: success(green indicator), pending(yellow indicator) and error(red indicator).
- See query execution time(it includes time to transfer data over network).
- Filter queries by string.
- Execute any query and see results immediately.
- Run mysql-proxy in Docker container.
Get binaries from releases page
go get github.com/gogoods/mysql-proxy
go install github.com/mjibson/[email protected]
cd $GOPATH/src/github.com/gogoods/mysql-proxy
$GOPATH/bin/esc -o fs.go -prefix web -include=".*\.css|.*\.js|.*\.html|.*\.png" web
go build
./mysql-proxy
There're 4 simple steps to get everything up and running:
-
Run binary from terminal like this:
./mysql-proxy_linux_amd64
. You'll see something like this:Forwarding queries from '127.0.0.1:4041' to '127.0.0.1:3306'
Web gui available at 'http://127.0.0.1:9999'
-
Tell your app to connect to MySQL via port 4041 instead of 3306.
-
Go to http://127.0.0.1:9999 and you'll see nice GUI.
-
Play with your app and see all SQL-queries flowing between your app and MySQL. No need for page refresh because websockets are used to communicate between frontend and backend.
Here're few use cases i use on my everyday basis so it may be helpful to someone.
Just run mysql-proxy on your local machine and point your app to it. You can also run few mysql-proxy instances each on it's own port. This is an easy way to keep multiple app separated and view queries independently.
Let's say you're writing your PHP code locally but run it on dev server and do not want to expose mysql-proxy to outside world. In this case here's what you may do:
- Upload mysql-proxy binary to remote dev server and run it like this:
./mysql-proxy_linux_amd64
- Create ssh tunnel from your local machine to remote dev server like this:
ssh -nNT -L 9999:127.0.0.1:9999 [email protected]
. This command will map your local:9999
to remote:9999
- Tell your remote app to use MySQL on port
:4041
- Open http://127.0.0.1:9999 locally.
See config.yaml.example as below:
gui: "127.0.0.1:9999"
use_embed_ui: true
proxies:
- alias: db1
enabled: true
listen: "127.0.0.1:19991"
mysql: "ip:port"
- alias: db2
enabled: true
listen: "127.0.0.1:19992"
mysql: "ip:port"
cp ./conf/config.yaml.example ./conf/config.yaml
- Edit
./conf/config.yaml
with your own configuration.
- Write Unit tests
- Implement more features of MySQL protocol
- Add query filtering by string
- Add sql code highlighting
- Add sql code formatting
- Add possibility to execute query right from GUI and see results
- Add ssl support
- Add support of PostgreSQL protocol
- ... and more
Currently mysql-proxy does not support secure connections via ssl. The workaround is to disable SSL on MySQL server or connect with option like --ssl-mode=DISABLED
You're very welcome to report bugs, make pull requests, share your thoughts and ideas!
MIT