I was having the same issue with DW cc. I was using my remote server as the testing server as well. That annoying little error message finally went away and I was able to connect to database.
I did the following:
Manage sites> servers> select advance tab, under "testing server" make sure you select PHP MySQL as the server model. Then back in the basic dialogue box make sure for the server you are using, that you have remote and testing both checked. If this is done, using localhost as your MySQL server in your connection box should not be an issue even if you're using your remote server as a testing server as well.