title: mysqldump: Got error: 1045 Access denied
body: <p>I am logged into an AWS instance and trying to copy a mysql database to a .sql file. I am using the command:</p>
  
  <pre><code>mysqldump -u [username] -p [databasename] &gt; [database].sql
  </code></pre>
  
  <p>Then entering the password and the following message comes up.</p>
  
  <pre><code>"mysqldump: Got error: 1045: Access denied for user '[username]'@'localhost' (using password: YES) when trying to connect."
  </code></pre>
  
  <p>I can login directly to mysql using the same credentials as above, but still get the same error. 
  I have tried a bunch of different ways for the command above, but it seems to be an issue with permissions or something similar. The user does have all privileges for the database when looking in phpmyadmin so I am not sure what is wrong? Any suggestions? Thanks</p>