Showing entries 1 to 10 of 59
10 Older Entries »
Displaying posts with tag: mysql-proxy (reset)
MySQL Proxy: 0.8.3 released

We are proud to announce the release of

MySQL Proxy 0.8.3 (alpha)

which updates MySQL Proxy for the protocol changes introduced in MySQL 5.5 and 5.6.

All users of MySQL Proxy 0.8.x are recommend to upgrade.


  • added network timeouts for connect, read and write operations
  • --proxy-connect-timeout, --proxy-read-timeout, --proxy-write-timeout
  • added IPv6 support
  • added initial support for the win-auth-method and its protocol extensions (MySQL 5.5.17)
  • added support for extracting the pluggable auth protocol information
  • Lua-API added:
    • con.client.challenge.auth_plugin_name
    • con.client.response.auth_plugin_name
  • fixed handling capability flags in the client auth response …
[Read more]
Lua and mysql-proxy: how to send a query to an email

I recently got an inquiry on how to receive an email every time a query was executed via the MySQL proxy. This is very simple and you can achieve it by simply piping the query to the *nix mail command. Here is the sample code (in a file caled send_mail.lua):

function read_query(packet)
  if string.byte(packet) == proxy.COM_QUERY then
    print("Hello world! Seen the query: " .. string.sub(packet, 2))
    print("Sending query to email:")
    os.execute("echo " .. string.sub(packet, 2) .. "| mail -s'Lua test' ")

To execute this, install proxy as per the instructions in the manual. Then simply run the proxy and point it at your script:

shell> bin/mysql-proxy --proxy-lua-script=send_email.lua &

Finally, connect to the proxy and issue a query:

[Read more]
Slapping MySQL-Proxy

I have old applications that need to read (and write) MyISAM tables that themselves receive lots of bulk updates. Time to try MySQL-Proxy.

MySQL Proxy is light on documentation and very few people written anything about working.   Most of what I have read says MySQL-Proxy is not ready for prim time.  I have hope so I had to give it a try.

I started with thee VMware servers. I setup one master and two read only slaves.   I tested the replication with mysqlslap from another independent server and it worked fine.  The slave never ran more then a second behind.

I downloaded mysql-proxy-0.8.0.tar.gz (64x version).  I …

[Read more]
MySQL Proxy: 0.8.0 released

MySQL Proxy 0.8.0 has been released at

While it took a while to get it out, it contains a lot of good stuff and will make a few more things possible for the future. First of all, it is the first release with a threaded network-backend allowing to use plenty of CPUs.

The other big infrastructure change is mostly for developers: out-of-tree plugins can now be written. Now you can write plugins for the MySQL Proxy against a installed MySQL Proxy. No need to have the MySQL Proxy's source code around.


  • added a threaded event handling layer
  • added support to change the auth-response on the way to the backend
  • added timing infrastruture
  • added out-of-tree plugins builds and pkg-config support
  • fixed handling of broken length encoded data in …
[Read more]
Catching erroneous queries, without MySQL proxy

MySQL Proxy is a really neat tool. I remember a few years back when I first saw Jan talking about it. Back in those days it was significantly different than it is now, but the concept remains the same: direct your database traffic through a man-in-the-middle. Chris Calender’s post on capturing erroneous queries with MySQL Proxy shows one use for Proxy. But wait. MySQL Proxy is just inspecting the MySQL protocol. And unless you’re using it for something else too, having a man in the middle to catch errors is like standing in the middle of the street and blocking traffic to count the cars on the street. Why don’t you stand on the sidewalk to count the cars instead?

Observing without interrupting

Maybe we can use tcpdump. If you search Google you’ll see lots of examples of using tcpdump and grep to extract queries from the MySQL protocol. These examples usually …

[Read more]
MySQL Proxy: 0.7.1 released

We are happy to announce that MySQL Proxy 0.7.1 is available in a source and binary release for many popular platforms.

This release contains a few minor bugfixes and changes in directory layout over the previous 0.7.0 release.

  • moved plugins to lib/mysql-proxy/plugins
  • moved lua modules to lib/mysql-proxy/lua
  • moved libs to lib/

Please report any problems on, our Launchpad discussion mailing list at or on IRC: #mysql-proxy on

Please note that the binary for Windows is currently still the old 0.6.1 release and will be updated …

[Read more]
MySQL Proxy meets: binlog - the examples

I just pushed the code for my replication changes on launchpad:

$ bzr branch lp:~jan-kneschke/mysql-proxy/replication

The presentation should be available ... soon.

One of the first examples is about filtering binlogs. If you want to remove all ALTER statements from the replication stream (or in this case the binlog files) you can just iterate the binlog and copy everything to a new binlog, but the ALTER statement

local binlog = require("mysql.binlog")
local tokenizer = require("proxy.tokenizer")

local f_in = assert("/tmp/binlog-test.log"))
local f_out = assert("/tmp/binlog-test-filtered.log", "w"))
print("filtering /tmp/binlog-test.log to /tmp/binlog-test-filtered.log")

for event in f_in:next() do
    if event.type == "QUERY_EVENT" then
            local tokens = tokenizer.tokenize(event.query.query)
            local first_token = tokenizer.first_stmt_token(tokens) …
[Read more]
Updated mysql-proxy benchmarking script (for proxy 0.7)

My previous post contained a lua script for MySQL proxy that would generate benchmarking information. However, just days (or maybe hours?) after I published it, release 0.7 of mysql-proxy was published, making my script obsolete. I’ve fixed this (it needed just a minor tweak), so here‘s a tarball with the following: trace.lua, which is the […]

Related posts:

  1. Using MySQL Proxy to benchmark query performance By transparently sitting between client and server on each request,...
  2. New release of MySQL Proxy GPL MySQL Proxy has a new release, just three days ago,...
[Read more]
MySQL Proxy: 0.7.0 released

MySQL Proxy 0.7.0 is finally released:

The full ChangeLog is a bit longer as 0.7.0 was more than a year in the works. To make it short: it is faster, better and more flexible.

Binaries will be release at shortly.

{% endexcerpt %} For everyone who just wants to update from 0.6.1 to 0.7.0 you should just see a major speed improvement.

  • A bug in the connect()-phase that caused to leave the Naggle-algorithm enabled caused a unneccesary high latency.
  • We also changed the buffering of result-sets to only …
[Read more]
Using MySQL Proxy to benchmark query performance

By transparently sitting between client and server on each request, MySQL Proxy offers many possibilities for query manipulation.

Many are explored in the cookbook, and they even include a histogram recipe. Still, I wanted to learn more about the proxy while working on a script that would let me get some stats on the queries executed against a server (or group of servers).

First things first, get a brief glimpse of the lua programming language since that’s what the proxy’s scripts are written in. Alternatively, you can jump straight into the sample scripts, extrapolate what you don’t understand of the syntax by making paralelizations against other …

[Read more]
Showing entries 1 to 10 of 59
10 Older Entries »