ID #1009

Error no. 1045: "Connection denied..."


The error message


Error No. 1045: Connection denied for 'someuser@somehost' (using password: YES/NO)


is a user authentication error. The user details specified do not "match" the user tables of the specified MySQL server. Common situations are

* No such user.
NOTE: MySQL does not use the OS's or domain's user's management. It operates its own user accounts. With a fresh MySQL installation the user ROOT is created with NO PASSWORD. When working with MySQL databases at ISP's an admin user most often must be activated from some web based Control Panel Application before connection to the MySQL server is possible. There could be more "rules" applying here (database and user naming conventions etc). Refer to the docs/support at the ISP for details on that. We can't give them!

* User is not allowed to connect from the actual host. Note that MySQL by default only allows connection from 'localhost'. To specify from where a user may connect SQL wildcards (% and _) can be used. Simply 'someuser@%' means that user 'someuser' may connect from everywhere.

* Wrong password, missing password or password specified where it should not

* If you are upgrading MySQL from an old version (4.0.x or lower) to a more recent (4.1.x or highere) and if you are still using a rather old PHP version you may need to execute this command from command-line client

SET PASSWORD FOR some_user@localhost = OLD_PASSWORD('newpwd');

(where some_user@localhost is the user used for this connection) since the format for storing passwords has changed between 4.0.x and 4.1.x versions.


Tags: -

Related entries:

You can comment this FAQ

Comment of John:
This is nice information however the key that I see missing from most posts is that you don't give me the "how to" part of it.

I still have no idea where to go or what SQL to type to grant the permissions.

You are kind enough to take the time to write all this information, I would suggest taking a few minutes more to type out the syntax of how the grant of permissions should be entered.
Added at: 2008-08-25 18:45

Comment of Peter Laursen:
This is the SQLyog FAQ. SQLyog users will use the SQLyog GUI user management functionalities. The situations where commmand line GRANT syntax are required are 1) After server install on a remote host user may want to grant root access from remote machine 2) When creating an SSL-user
Added at: 2008-09-03 12:56

Comment of lostcause:
well, what if my connection outputs are ok, and the mysql database connects with no problems on the first time operating an insert but on the second time, and so on, operating that same insert gives the 1045 error? what does this means?
Added at: 2013-07-12 19:26

Comment of Peter Laursen:
It still means the same. It is still a MySQL *SERVER* error. But since this happens this way I think you must be using HTTP tunnel (if you are using SQLyog)? Or it could be a server bug. What is the server version? Anyway .. this is not the best place for supporting you with this. Please use our Forums to ask support or mail to (but only if you are a SQLyog user) -- Peter Laursen -- Webyog
Added at: 2013-07-12 20:34