This is a tricky one, I have the following output:
mysqldump: Got error: 1045: Access denied for user \'root\'@\'localhost\' (using password: YES) when tr
I had the same error. Only occurred after moving from my normal work PC to a PC at a different location.
I had to add my public IP ho address to Remote MySQL in my CPanel at my host site