I think you are trying to kill elephant with fly swatter.
Bash may not be the right tool, but it would be interesting to see you get bash to manipulate MySQL.
Java, Perl, C/C++, PHP, Korn, python, etc., all have API's, but bash/born shell does not seem to have one.