// The easiest way to do this is to use a client section of the ~/.my.cnf file, and add the credentials there. [client] user=root password=somepassword ...