Page 1 of 2

Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 19:52
by kamild1996
Hi!
I'm hosting a MySQL database (with XAMPP of course). I put PHP script (which is using my database) in my site (not in my PC - I bought a WWW hosting). But when I'm trying to run this script, I get this:
Lost connection to MySQL server at 'reading initial communication packet', system error: 111
I have an internal IP but I'm using DynDNS. Address to script is: http://this-is-minecraft.xaa.pl/bany/banlist.php
How to fix it?

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 22:42
by Sharley
XAMPP is working.

Have you asked your hosting service this question?

Perhaps there is a conflict with the version of MySQL used in XAMPP and the MySQL version used by your hosting service, especially if the hosting service version is older.

The readme_en.txt file in the xampp folder has all the component version numbers - check the version used by your hosting service against this list.

These Google search results may help.

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 22:57
by kamild1996
Have you asked your hosting service this question?

No.

Perhaps there is a conflict with the version of MySQL used in XAMPP and the MySQL version used by your hosting service, especially if the hosting service version is older.

This is from phpMyAdmin - hosting:
Server: Localhost via UNIX socket
Server version: 5.1.56
Protocol version: 10
User: csrafael@localhost
MySQL charset: UTF-8 Unicode (utf8)


And this is from phpMyAdmin - XAMPP:
Server: localhost via TCP/IP
Server version: 5.5.16
Protocol version: 10
User: Mc-Wysypisko@localhost
MySQL charset: UTF-8 Unicode (utf8)


These Google search results may help.

I tried to resolve this problem by solutions found in Google. But no one of these works.

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 23:01
by Sharley
Are you trying to connect to the database in XAMPP on your PC from the hosting service web site?

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 23:07
by kamild1996
Are you trying to connect to the database in XAMPP on your PC from the hosting service web site?

Maybe I didn't understand this... but my script is connecting to a XAMPP-hosted database located in my PC.

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 23:17
by Sharley
You will need to open phpMyAdmin and select the user for the database you are trying to connect with.

Then click on Edit privileges at the end of the line and change the Host setting from localhost to Any host (%) then click on Go.

No need to change anything else except you will need to allow access through any firewalls/routers you may be using - port 3306 is the MySQL port.

Close phpMyAdmin and try and connect to the database again from your remote server.

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 23:22
by kamild1996
Then click on Edit privileges at the end of the line and change the Host setting from localhost to Any host (%) then click on Go.

I did it before creating this topic.

No need to change anything else except you will need to allow access through any firewalls/routers you may be using - port 3306 is the MySQL port.

Like above. I did it before creating this topic.

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 23:27
by Sharley
kamild1996 wrote:
Then click on Edit privileges at the end of the line and change the Host setting from localhost to Any host (%) then click on Go.

I did it before creating this topic.

No need to change anything else except you will need to allow access through any firewalls/routers you may be using - port 3306 is the MySQL port.

Like above. I did it before creating this topic.
How are we supposed to know that unless you tell us? :shock:

Remember we can't see your screen or know what you are doing or what you have done unless you tell us.
viewtopic.php?f=16&t=48331

Re: Lost connection to MySQL server at '...'

PostPosted: 08. January 2012 23:36
by kamild1996
Ok.

'Then click on Edit privileges at the end of the line and change the Host setting from localhost to Any host (%) then click on Go.'
I went to my XAMPP's phpMyAdmin (http://127.0.0.1/phpmyadmin/) and I choose "Privileges". Then I clicked "Edit privileges", in "Change Login Information / Copy User" changed "Host" to "Any host" and clicked "Go".

'No need to change anything else except you will need to allow access through any firewalls/routers you may be using - port 3306 is the MySQL port.'
I just unlocked port 3306 and 3307 in my router's control panel. Results:
Image

EDIT:
And I got screens when forwarding posts with my DynDNS and NoIP addresses.
http://imgur.com/UGYV7,6tdMq

Re: Lost connection to MySQL server at '...'

PostPosted: 09. January 2012 00:06
by Sharley
It seems you are not connecting to your database.

Check the mysql_error.log file in the \xampp\mysql\data folder.

Check the log files at your hosting service (is it cPanel).

Have you started MySQL in the XAMPP control Panel and is it running?

Re: Lost connection to MySQL server at '...'

PostPosted: 09. January 2012 00:13
by kamild1996
Check the mysql_error.log file in the \xampp\mysql\data folder.

5 kb of text. Content in link below:
http://pastebin.com/4dvKAdSw

Check the log files at your hosting service (is it cPanel?).

Yes, this is cPanel.
Which logs? From cPanel? Or from phpMyAdmin?

Have you started MySQL in the XAMPP control Panel?

Of course. Apache and MySQL are running.

PS: When I put this script in "htdocs" folder in XAMPP and I go to "http://localhost/banlist.php", script is working. But instead of these settings in PHP file:
$server = "mc-wys.dyndns.biz";
$dbuser = "Mc-Wysypisko";
$dbpass = "goodPassword";
$dbname = "mcwys_banreport";

i set them to:
$server = "localhost";
$dbuser = "Mc-Wysypisko";
$dbpass = "goodPassword";
$dbname = "mcwys_banreport";

And it's working...

Re: Lost connection to MySQL server at '...'

PostPosted: 09. January 2012 00:23
by Sharley
mysql_error.log wrote:120108 23:51:18 [Warning] IP address '74.63.120.217' could not be resolved: Żądana nazwa jest prawidłowa i została znaleziona w bazie danych, ale dane, z którymi jest skojarzona, są niepoprawne.
:?:

In cPanel you can read the server's log files, try the error log first.

Re: Lost connection to MySQL server at '...'

PostPosted: 09. January 2012 00:33
by kamild1996
I found a translation for it.

"Żądana nazwa jest prawidłowa i została znaleziona w bazie danych, ale dane, z którymi jest skojarzona, są niepoprawne."

In English:
"The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for.".

There is no error logs in cPanel:
Image

Re: Lost connection to MySQL server at '...'

PostPosted: 09. January 2012 00:53
by Sharley
$server = "mc-wys.dyndns.biz";
$dbuser = "Mc-Wysypisko";
$dbpass = "goodPassword";
$dbname = "mcwys_banreport";
Have tried Any host in the server field and/or your IP address?
Then try and access it from your hosting server web page again.

Re: Lost connection to MySQL server at '...'

PostPosted: 09. January 2012 00:58
by kamild1996
Sharley wrote:
$server = "mc-wys.dyndns.biz";
$dbuser = "Mc-Wysypisko";
$dbpass = "goodPassword";
$dbname = "mcwys_banreport";
Have tried Any host in the server field and/or your IP address?
Then try and access it from your hosting server web page again.

Tried this. No effect.