Test MySQL credentials from Linux command line?
mysql -h host -u user -p&lt;whatever&gt; -e"quit"


This allows you to use the same connection string that you use for programmatically sending queries to the server. You can add || exit 1 to the end to auto exit on invalid arguments. You may also want to redirect stderr to /dev/null if you do not like the auto generated MySQL error message.