We have just discovered that cPanel currently (11.40.1) has an issue with parsing out single quotes in the ~/.my.cnf. For instance, if your /root/my.cnf file looks like:
With the way that cPanel currently parses this, it uses the password with the single quotes, and sends that off to MySQL. If you’re doing something that requires a connection with MySQL, this of course fails; the password doesn’t really have single quotes included around it.
As a workaround, either remove the quotes from the ~/.my.cnf or change them to double quotes – both work. If you want to know more, This was submitted as a bug report with cPanel.