Re: SSH connection from a client machine - localhost works but not 127.0.0.1

2004-08-07 Thread Whil Hentzen
On Monday 02 August 2004 22:34, James Weisensee wrote:
> What does your '/etc/hosts' file contain?  Sounds like
> it may have the following entry:
>
> 127.0.0.1   localhost.localdomain
>
> change it to:
>
> 127.0.01localhost

Actually, it has 

127.0.0.1  localhost.localdomain localhost

(two entries)

> Yes, add 'localhost.localdomain' to mysql.user

Got it.

> another option, Why not just SSH to 'daisy' and issue:
>
> shell> mysql -u root -p
>
> and let it default to localhost.

Well, I did get that to work, but I'm trying to understand why...

Michael's explanation of the difference between 127... and localhost with the 
sockets vs TCP made a lot of sense.


-- 
Whil

Moving to Linux: Freedom, Choice, Security, Opportunity
http://www.hentzenwerke.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: SSH connection from a client machine - localhost works but not 127.0.0.1

2004-08-02 Thread Michael Stassen
From mysql's point of view, localhost and 127.0.0.1 are not the same thing. 
 When you connect with

  mysql -h localhost -u root -p
or simply
  mysql -u root -p
(localhost is the default), you are connecting via unix socket, so the 
user=root, host=localhost entry is used.  When you connect with

  mysql -h 127.0.0.1 -u root -p
however, you are connecting to 127.0.0.1 via tcp/ip, and there must be an 
entry with user=root and host=the.client.machine.  Currently, you have 
entries for [EMAIL PROTECTED] and [EMAIL PROTECTED], so you can log in as 
root from localhost via unix socket or daisy.example.com via tcp/ip.  See 
the manual 
for the details.

If you want the client to connect via tcp/ip when you are already on the 
server, you'll have to add an entry to allow that, but there is no advantage 
to connecting via tcp/ip when you're already on the server.  I'd forget 
about 127.0.0.1 and just use the unix socket.

Michael
Whil Hentzen wrote:
Hi folks,
Now that I can connect to my MySQL server using the Unix sockets (e.g.
   [EMAIL PROTECTED] ~] mysql -u root
I'm moving on to the next step - connecting via TCP/IP.
Since I don't have physical access to the box (well, I'm just too lazy to walk 
down to the basement), I SSH into the box from a second machine (the name of 
the box that 'www.example.com' is running on is called 'daisy'):

shell> ssh www.example.com
[EMAIL PROTECTED]'s password:
[EMAIL PROTECTED] ~] mysql -h localhost -u root -p
Enter password: 
mysql>

Works great. Less filling, too.
But if I try
[EMAIL PROTECTED] ~] mysql -h 127.0.0.1 -u root -p
Enter password: 
ERROR 1130: Host 'localhost.localdomain' is not allowed to connect to this 
MySQL server
[EMAIL PROTECTED] ~]

I've googled through a bunch of posts, and the old line about 'understanding 
the words, but not the sentences' applies here. As best I can tell, this 
problem normally comes up when the domain (such as www.example.com) isn't in 
the users table. In this case, 127.0.0.1 should be equivalent to 'localhost', 
which is in there:

mysql> select host, user, password from mysql.user ;
+--+--+--+
| host | user | password |
+--+--+--+
| localhost| root | 48bf4fd20c61a2f0 |
| daisy.example.com | root | 48bf4fd20c61a2f0 |
| localhost|  |  |
| daisy.example.com |  |  |
+--+--+--+
Do I need to change the 'localhost' entries to 'localhost.localdomain' in 
order for 127.0.0.1 to work? If I do so, will "mysql -h localhost" then fail?

I know I could just try it out myself, but I want to know WHY *s*
Thanks,

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: SSH connection from a client machine - localhost works but not 127.0.0.1

2004-08-02 Thread James Weisensee

What does your '/etc/hosts' file contain?  Sounds like
it may have the following entry:

127.0.0.1   localhost.localdomain 

change it to:

127.0.01localhost 

or

Yes, add 'localhost.localdomain' to mysql.user

another option, Why not just SSH to 'daisy' and issue:

shell> mysql -u root -p

and let it default to localhost.

HTH,
James



> But if I try
> 
> [EMAIL PROTECTED] ~] mysql -h 127.0.0.1 -u root -p
> Enter password: 
> ERROR 1130: Host 'localhost.localdomain' is not
> allowed to connect to this 
> MySQL server
> [EMAIL PROTECTED] ~]
> 
> I've googled through a bunch of posts, and the old
> line about 'understanding 
> the words, but not the sentences' applies here. As
> best I can tell, this 
> problem normally comes up when the domain (such as
> www.example.com) isn't in 
> the users table. In this case, 127.0.0.1 should be
> equivalent to 'localhost', 
> which is in there:
> 
> mysql> select host, user, password from mysql.user ;
> +--+--+--+
> | host | user | password |
> +--+--+--+
> | localhost| root | 48bf4fd20c61a2f0 |
> | daisy.example.com | root | 48bf4fd20c61a2f0 |
> | localhost|  |  |
> | daisy.example.com |  |  |
> +--+--+--+
> 
> Do I need to change the 'localhost' entries to
> 'localhost.localdomain' in 
> order for 127.0.0.1 to work? If I do so, will "mysql
> -h localhost" then fail?
> 
> I know I could just try it out myself, but I want to
> know WHY *s*



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



SSH connection from a client machine - localhost works but not 127.0.0.1

2004-08-02 Thread Whil Hentzen
Hi folks,

Now that I can connect to my MySQL server using the Unix sockets (e.g.
   [EMAIL PROTECTED] ~] mysql -u root
I'm moving on to the next step - connecting via TCP/IP.

Since I don't have physical access to the box (well, I'm just too lazy to walk 
down to the basement), I SSH into the box from a second machine (the name of 
the box that 'www.example.com' is running on is called 'daisy'):

shell> ssh www.example.com
[EMAIL PROTECTED]'s password:
[EMAIL PROTECTED] ~] mysql -h localhost -u root -p
Enter password: 
mysql>

Works great. Less filling, too.

But if I try

[EMAIL PROTECTED] ~] mysql -h 127.0.0.1 -u root -p
Enter password: 
ERROR 1130: Host 'localhost.localdomain' is not allowed to connect to this 
MySQL server
[EMAIL PROTECTED] ~]

I've googled through a bunch of posts, and the old line about 'understanding 
the words, but not the sentences' applies here. As best I can tell, this 
problem normally comes up when the domain (such as www.example.com) isn't in 
the users table. In this case, 127.0.0.1 should be equivalent to 'localhost', 
which is in there:

mysql> select host, user, password from mysql.user ;
+--+--+--+
| host | user | password |
+--+--+--+
| localhost| root | 48bf4fd20c61a2f0 |
| daisy.example.com | root | 48bf4fd20c61a2f0 |
| localhost|  |  |
| daisy.example.com |  |  |
+--+--+--+

Do I need to change the 'localhost' entries to 'localhost.localdomain' in 
order for 127.0.0.1 to work? If I do so, will "mysql -h localhost" then fail?

I know I could just try it out myself, but I want to know WHY *s*

Thanks,

-- 
Whil

Moving to Linux: Freedom, Choice, Security, Opportunity
http://www.hentzenwerke.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]