Page 1 of 1

tunnel.php not working

Posted: Fri 19 Feb 2016 06:51
by kneighbour
I am using UniDac 5.5.12 in Delphi XE7. In one project I use this component to connect to a MySQL database hosted on the Internet. I use a HTTP tunnel provided by the Devart tunnel.php (V1.66) file. I have also tried V1.67 of this file with the same issue.

This application has been working for ages (a year or so) with no problems. Today, it did not work. I am pretty sure it is NOT a problem with any Devart component or the tunnel.php file. I am hoping that someone here might know where I can look to resolve the problem.

This morning we could not connect via tunnel.php. We got the error "Access denied for user 'user'@'localhost' (using password: YES)". This is from computers all over the place (so not a firewall issue). We got onto our web hosting guys and eventually we restarted the MySQL server and also dropped and recreated our MySQL users. It all looked good. I can connect and HTTP tunnel to our MySQL database using Maestro or Navicat. So it looks like the MySQL DB is working and allowing connections. But it does NOT work still using the Devart tunnel.php system.

The next thing I did was copy the MySQL database from the problem host to a completely different host. Simply backed it up and restored to the new host. Recreated users and copied across the Devart tunnel.php. Works perfectly.

But it still does not work on our main hosting site. I am at a loss as to what to do next. If anyone has a hot tip, I would more than welcome it!

This is a link the to log file http://finchcorp.com.au/httptunnel_server.log

Re: tunnel.php not working

Posted: Fri 19 Feb 2016 14:28
by ViktorV
The 'YourUserName'@'YourComputerName' message is a server response to an authentication fail. This message means that no user with the 'YourUserName' name exists or you have entered an invalid password, or a user with the 'YourUserName' name has no server access rights from the 'YourComputerName' PC.
To solve the problem, you should add the necessary rights to the YourUserName account or create a user with the necessary rights. The needed information can be found in the MySQL reference manual (e.g.: http://dev.mysql.com/doc/refman/5.5/en/grant.html).

Re: tunnel.php not working

Posted: Sat 20 Feb 2016 20:38
by kneighbour
You are of course correct in a normal situation. But not this time.

This is a situation that has been working for years...the MySQL databases and user and privileges are all there and are correct. We have restarted the MySQL server, dropped/recreated the users and even used another database.

As I said - I can connect to this database with other systems (ie tunneling using Maestro and Navicat) with no problems at all. In this same program module I can connect via my own PHP code with no problem. The user definitely exists and the password is definitely correct.

The Devart tunnel.php also worked just fine (and has been for ages) up until a specific time when something happened on the host. It also works just fine at another host. But something changed at the main host that is now stopping the Devart tunnel.php from working. The hosting support people are not listening to us.

The actual error message that is returned from tunnel.php is of the form "#28000Access denied for user user99'@'::1' (using password: YES)"

I am a bit concerned that the server name and port is blank. Perhaps the error should be more like "#28000Access denied for user user99'@'localhost:3306:1' ?

But the log itself shows the full server host so perhaps it is ok.

Re: tunnel.php not working

Posted: Sun 21 Feb 2016 02:43
by kneighbour
A search of Google brings up a possibility.

"You probably have an anonymous user ''@'localhost' or ''@'127.0.0.1'". These users are created when installing MySQL and should be deleted.

I am trying to get my hosting company to investigate this possibility, but these people are not that helpful.

Your tunnel.php is not using the general PHP connection objects - which makes me wonder if there is something there that is making this anon user a problem?

Re: tunnel.php not working

Posted: Mon 22 Feb 2016 12:41
by ViktorV
If you use http tunneling, the connection to MySQL server is made from PHP server. Since you have MySQL server and PHP server on the same machine, you may get the error due to access block to MySQL server from the local host. To solve the problem, please, contact your MySQL server administrator.

Re: tunnel.php not working

Posted: Mon 22 Feb 2016 20:16
by kneighbour
Perhaps you missed this part of my original post?

"As I said - I can connect to this database with other systems (ie tunneling using Maestro and Navicat) with no problems at all. In this same program module I can connect via my own PHP code with no problem."

Re: tunnel.php not working

Posted: Tue 23 Feb 2016 08:37
by kneighbour
Fixed it!!

I had to add a % wildcard into the MySQL Remote Hosts screen on the host cpanel. For some reason it was blocking the tunnel.php stuff from getting through.

Re: tunnel.php not working

Posted: Wed 24 Feb 2016 08:41
by ViktorV
It is good to see that the problem has been solved.
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.

Re: tunnel.php not working

Posted: Mon 15 Jul 2019 21:45
by guverdik
kneighbour wrote: Tue 23 Feb 2016 08:37 Fixed it!!

I had to add a % wildcard into the MySQL Remote Hosts screen on the host cpanel. For some reason it was blocking the tunnel.php stuff from getting through.
Hi bro. Same problem my UniConnection component. How solve that problem. I use delphi UniConnection settings Where is it.

Re: tunnel.php not working

Posted: Mon 22 Jul 2019 07:15
by ViktorV
The settings in question are performed on the hosting, and not set in the TUniConnection component.