Search for this error with regards to WordPress and you will find lots of articles talking about how the wp-config.php has bad credentials. Funny thing is, I came across this error and credentials were not the problem. Here’s how I fixed it.
My site is on a remote server. I normally create a database, give a user permissions, then associate that user with that database. That’s all it used to be on my old server. Now, I have to go into cPanel and update the “Remote MySQL” screen and add the IP of the server. It’s weird. It’s like the server does not have permission to look at itself. Upon realizing this and proving it worked to the tech support rep at the hosting company, even he was baffled why that change was necessary.