title: "Access denied for user 'username'@'localhost' (using password: YES)" when deploying Rails with Capistrano
body: <p>I am standing up a new Ubuntu server running MySQL. I have Capistrano set up on my development server and am trying to deploy:cold after running deploy:setup. After the deploy script tries to run </p>
  
  <pre><code>executing "cd /home/adm1n/www/knowit/releases/20121112152400 &amp;&amp; bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
  </code></pre>
  
  <p>I keep getting this message:</p>
  
  <pre><code>Rake Aborted!
  Access denied for user 'specialusername'@'localhost' (using password: YES)
  Tasks: TOP =&gt; environment
  </code></pre>
  
  <p>I have 'specialusername' created in my database on the mysql server for both localhost and %.
  I removed the empty user ' ' @ localhost row in the user database.
  I have added the IP address of the server to my my.cnf file and commented out the 127.0.0.1 line.</p>
  
  <p>Here is my deploy.rb file for production:</p>
  
  <pre><code>production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: mydatabasename
  username: specialusername
  password: crazypassword
  socket: /tmp/mysql.sock
  pool: 5
  timeout: 5000
  </code></pre>
  
  <p>I think that I may not be understanding how this works. On my Site5 server I have never had to specify which host I was accessing mysql from. But in all my reading it seems that I must specify a specific user@hostname. This makes it a little difficult if I am deploying from many different locations around the country as I travel. OR do I merely need to use the hostname of my laptop regardless of my current IP address? Thanks for any insight and solutions you can provide. I have not found any articles that have provided me precisely what I need to fix this issue.</p>