MySQL Forums
Forum List  »  Quality Assurance

connect to server through localhost and 127.0.0.1
Posted by: guo xiang
Date: April 02, 2008 02:50AM

suppose I create two account on mysql server : bob@localhost and bob@127.0.0.1 with differrent password boblocal and bob127

then I connect to server with:
$mysql -ubob -pboblocal -S /tmp/mysql.sock ,that's correctly.
*But* ,when I use:
(1)$mysql -ubob -pbob127 -h127.0.0.1
ERROR 1045 (28000): Access denied for user 'bob'@'localhost' (using password: YES)
If I change password to boblocal,I can login and it display currentuser:bob@localhost
and via unix socket.

(2)If I start mysqld with --skip-name-resolve,I can use bob@127.0.0.1 with password bob127 login
*OR*
(3)If I start mysqld normal( that is without --skip-name-resovle)I delete bob@localhost and add it again ,I can alsouse bob@127.0.0.1 with password bob127 login

I search the Mysql Manual,I find mysqld start with load the authorities list and sort it as follows:
+-----------+----------+-
| Host | User | …
+-----------+----------+-
| localhost | bob | … ...
| localhost | |root | ...
| 127.0.0.1 | bob | … ...
| 127.0.0.1 | root | … ...
+-----------+----------+-

If use it to explain the case 1 and 2 . how to explain the case 3 with it ?
Thank U!

Options: ReplyQuote


Subject
Views
Written By
Posted
connect to server through localhost and 127.0.0.1
9163
April 02, 2008 02:50AM


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.