Add mysql support

Would you mind that I add a small improvment to your script. It should have no impact on your current behavior