A buddy of mine was recently setting up a new installation of Courier with virtual user support via MySQL. He ran into an issue when trying to get authdaemond to connect to a remote MySQL installation. No matter what he changed in authmysqlrc, the following kept appearing in his mail log (I've changed hostnames and usernames):

authdaemond: failed to connect to mysql server (server=db.slaptijack.com, userid=mailadm): Access denied for user 'mailadm'@'mail.slaptijack.com' (using password: YES)

The obvious conclusion is a permissions problem in the MySQL database. Double checking the GRANTS in MySQL and testing a remote connection via the mysql client ruled out that possibility.

In desperation, he began combing through authmysqlrc line by line. Finally, dumb luck helped him stumble across this issue (I've underlined the problem):

MYSQL_PASSWORD          hicCogIjNu    

Somehow, a tab had mistakenly been added to the end of the password field. Removing that tag solved the problem straight away. The lesson to be learned is that Courier (at least in the case of authdaemond and MYSQL_PASSWORD) assumes the value assignment in a configuration file to begin with the first non-whitespace character and continue to the end of the line.