I’m setting up mysql locally on my laptop this weekend, and ran into a snag that cost me at least an hour. To mimic a web app I am running locally, I needed to connect to mysql with a specific username and password. But no matter what I did, I always got this error:

MySQL: access denied for user: username (Using password: YES)

I got this when connecting via the command line client and via ColdFusion. Finally after some googling I came across this blog post suggesting to change the privilege details to allow connecting from ‘localhost’ instead of ‘%’. The % indicates a wildcard and should allow connections from any host. But for some reason this was not working for me. Changing it to ‘localhost’ fixed the problem and allowed me to connect. I think it may have had something to do with the fact that I checked a box when installing that would only allow connections from the localhost.

I used this SQL to fix the host setting after connecting to the ‘mysql’ database:

update user set Host=’localhost’ where User=’myUserName’


  1. Gaxton says:

    Pls I'm experiencing a serious sql problem… i changed the mysql password then did some changes then afterwards the site would nt open, it keeps saying…..
    Access denied for user 'v_root'@'cgi0603.int.bizland.net' (using password: YES)

  2. Ryan Stille says:

    You need to make sure you have a password set for YourUserName connecting from host 'cgi0603.int.bizland.net'.   Maybe you should change your connection settings to specifically connect to 'localhost', if your database server is running locally.