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
Try to remove the space when using the -p-option. This works for my OSX and Linux mysqldump:
mysqldump -u user -ppassword ...