MySQL Forums
Forum List  »  MySQL Administrator

Re: ERROR 1045 (28000) ERROR
Posted by: Ronan Cashell
Date: October 29, 2012 02:06AM

Logins in MySQL can be a little strange to understand.

When identifying a login, MySQL first searches by host then by username. However, the searches are not exact and wildcards can be included. Consider the following:

Host Username Password
xtest1 tester abc
xtest2 tester xyz

If the user tester attempts to login from xtest1 it must provide the password abc, however, logging in from xtest2 the password xyz must be used.

With wildcards this becomes even more complicated (wildcards are always placed at the end when sorting hosts):

Host Username Password
xtest1 tester abc
% tester xyz

In this case here from xtest1 the password to be used is abc but any other host the password xyz must be used.

There are also special host names (localhost) which represents an internal connection via a socket. So if you have:

Host Username Password
localhost tester abc

If you attempt to login using the -h option and the hostname (or IP address) this will not find an entry in the users table and hence will fail the login. If on the other hand you do not supply a hostname (if you are logging in from the same machine) then it will use localhost and perform the login with the password abc.

Ronan Cashell
Senior Oracle/MySQL Administrator
IT Integrated Business Solutions

Options: ReplyQuote

Written By
September 19, 2012 07:30PM
Re: ERROR 1045 (28000) ERROR
October 29, 2012 02:06AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.