I finally managed to find that the DBI::trace_msg error is being caused by the $sth->prepare line. When it hits that line, it tries errors and tries to print the error message, but for some reason DBI::trace_msg is not defined and THAT causes an error as well. So now I know where the error is, but not what the error is since the error reporting process is blown up as well. I've checked mysql and the permissions for that username and password are correct and working.