This is a repository of useful MySQL Proxy scripts targetting mainly developers in quest of debugging.
MySQL Proxy >= 0.8 (May work with earlier version, untested)
$ mysql-proxy --proxy-lua-script=/absolute/path/to/the/script.lua
Prints every SQL command received while cleaning obsolete spaces. Every command appears on one line with the following additional information:
- an optional informative message about the query,
- the number of rows returned or affected by the query,
- the amout of time (in ms) it took to run the query.
Additionally, colors are used to provide direct information on the queries:
- yellow: when not using a good index (no_good_index_used flag),
- yellow + bold: when not using an index at all,
- red: when an error occured,
- pink: for queries affecting records.
Colors are also used to denote slow queries: time displayed in red instead of green. When a query returns no rows nor affect records, "" is displayed using red in reverse video.
Same as debug.lua, but without shell colors.
Simulates a server being slow because of huge traffic.
The sleep command accepting a float as argument is required to make this script works out of the box.
The slowdowns can be configured to make all requests longer by a factor or by a fixed amount of time (or both).
By default, requests are made twice slower with an additional overhead of 0.1s.