Bug #40478 Query Browser using ssh tunnel failing when using 'localhost'
Submitted: 3 Nov 2008 14:16 Modified: 12 Feb 2009 13:50
Reporter: Kennet Svanberg Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.2.12 OS:Linux (Ubuntu 8.04)
Assigned to: CPU Architecture:Any
Tags: query browser, settings, ssl tunnel

[3 Nov 2008 14:16] Kennet Svanberg
Description:
Connecting to a remote mysql server using a ssl tunnel with server setting set to 'localhost' does not work, however '127.0.0.1' works.

I have set up at ssh tunnel using:

ssh -L 3307:xxx.xxx.xxx.xxx:3306 username@xxx.xxx.xxx.xxx.xxx

When running from the prompt without -h parameter it works alright. When I use the same settings in the query browser I get Error 1045, ping is ok. 

Eventuelly I tried to change server setting from localhost to 127.0.0.1 then it works. Localhost is not redefined or missing from /etc/hosts file

How to repeat:
Do as above
[3 Nov 2008 18:54] Valeriy Kravchuk
Thank you for a problem report. Please, send the results of

select user, host from mysql.user;

as a private comment. Try also to log in with the same user and -h localhost from mysql command line client and inform about the results.
[4 Nov 2008 12:29] Kennet Svanberg
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 30648
Server version: 5.0.45-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select user, host from mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'eniro'@'localhost' for table 'user'
[5 Nov 2008 16:51] Susanne Ebrecht
The user you are using for the select needs the grants for selecting the tables user at the database mysql.

Superuser usually will have this grants by automatism. The default mysql superuser has the name "root".

Please try it again and please copy the result as private comment.
[5 Nov 2008 17:11] Kennet Svanberg
No offence, I might be to stupid to see to connection, but the problem is not wether I have access to this or that table. When I change from 'localhost' to '127.0.0.1' in the settingspanel in the query browser I can connect. Ping works in both cases but the actually connecting to the database is not possible with localhost just 127.0.0.1
[6 Nov 2008 13:29] Kennet Svanberg
+-------+----------------+
| user  | host           |
+-------+----------------+
| eniro | %              |
| root  | 127.0.0.1      |
| usr2  | 91.196.240.228 |
| eniro | localhost      |
| root  | localhost      |
| root  | smssok01       |
+-------+----------------+
[7 Nov 2008 16:03] Susanne Ebrecht
This could be releated to a known server bug.

Which MySQL server version do you use?
[9 Nov 2008 18:45] Kennet Svanberg
Server version: 5.0.45-log Source distribution
[12 Jan 2009 13:50] Susanne Ebrecht
Please try to grant the rights for your user also to 127.0.0.1.

There is a problem under Linux with the wildcard '%' for IP adresses.
[30 Jan 2009 23:21] Paul Verhaegen
Thank you for reporting this and giving a work-around too. I can confirm this behavior (localhost not working over ssh tunnel, but 127.0.0.1 does) on mysql-query-browser version 1.2.12 (Ubunutu 8.10 Intrepid Ibex).
[13 Feb 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[19 Mar 2009 0:02] Kamil Bartoszek
I have the same issue, it happens in both Linux and Windows.

I have set up SSH tunneling:

sudo ssh kamiox@somehost.com -L 127.0.0.1:1111:sql.host.pl:3306

when I try:

telnet 127.0.0.1:1111

output:

telnet 127.0.0.1 1111
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
8
4.1.22-log

I have no problem to use: 

mysql -u kamiox_informatyka -h 127.0.0.1 -P 1111 -p

output:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3870722
Server version: 4.1.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> 

But when i try use Mysql Query Browser i encounter this error:

Could not connect to host '127.0.0.1'.
MySQL Error Nr. 1045
Access denied for user 'kamiox_informaty'@'77.xx.xx.xx' (using password: YES)

Click the 'Ping' button to see if there is a networking problem.

Why username gets cut off?
[19 Mar 2009 0:52] Kamil Bartoszek
Ok, my problem come from using more then 16 characters in username.