When I imported production database and configured code on my local dev machine, I got this error even I had updated wp-config.php with correct information. I fixed the problem after some changes. This article explains troubleshooting steps to fix this error.
“An error occurred accessing a data source.”
Generally it is due to database or webservice connection. If you are getting this error
1. First make sure the user has sufficient permission to access the database/web service.