Why re-invent the wheel?
For most servers I admin, I use the MySQL Administration Tool. Works
real slick. Available from mysql.com/downloads. Works on Linux and
If I need a quick change, I'll use phpMyAdmin (Google it). PHP based
MySQL administration system. Also works really slick.
Can you not use these tools?