To keep your database safe from SQL injection attacks, GreenSQL is a new Open Source database firewall that you might give a try. GreenSQL works as a reverse proxy and has built in support for MySQL. The logic is based on evaluation of SQL commands using a risk scoring matrix as well as blocking known db administrative commands (DROP, CREATE, etc). GreenSQL is distributed under the GPL license.
greensql architecture
GreenSQL Architecture
GreenSQL
GreenSQL Web Frontend
In addition to black list patterns that are used to block SQL, GreenSQL have also a white list. If the query is considered illegal – whitelist is check. If it was found in the whitelist, it will be redirected to genuine MySQL server. If it was not found, an empty result set will be send to application. The project is written in C++ and PHP. You can find a demo online to see how GreenSQL looks like. Download is also available from sourceforge.