|
|
|
| Web Hosting |
![]() ![]() |
Lost Connection To Mysql ,..., System Error: 111 In |
Feb 5 2008, 06:22 AM
Post
#1
|
|
|
Member [ Level 1 ] Group: Members Posts: 48 Joined: 5-February 08 From: Japan Member No.: 28,155 |
While I was trying to connect to my database or even create one using PhP mySQL I was given the followoing error:
Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in Has somebody encontered a similar report? I have my database created using the cpanel together with a user name and password. I wonder if it is a server issue? What can you do if you have not access to the configuration files? This post has been edited by rockarolla: Feb 5 2008, 06:23 AM |
|
|
|
Feb 5 2008, 09:48 AM
Post
#2
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 2,296 Joined: 16-August 05 Member No.: 7,896 myCENTs:25.55 |
If you can access your database through cpanel and PHPMyAdmin, it's not a server issue. So, the issue is inside your php program.
|
|
|
|
Feb 5 2008, 02:32 PM
Post
#3
|
|
|
Member [ Level 1 ] Group: Members Posts: 48 Joined: 5-February 08 From: Japan Member No.: 28,155 |
I don't think so. Here is my code. Its a very simple code just to see if I can ever establish a connection with my database:
CODE function open_connection() { $host='localhost:3307'; $user='any'; $db='my_db'; $password='my_pass'; $conn=mysql_connect($host,$user,$password); mysql_create_db ($db,$conn); mysql_select_db($db); return $conn; } If I call this function within my file I get the error: Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in I've looked about several forums and I didn't get any concern to my code. Also I tried using mysql_pconnect() as someone suggested that the problem maybe dropping connection, but it didn't work as well. I don't have any rights to configure neither php nor mysql. So I guess the provider doesn't want anyone to connect to their database... On the same host I cannot use code like this: CODE function add_hits(){ $opFile = fopen ("counter.txt", "r"); $handle = fread ($opFile, filesize ("counter.txt")); fclose ($opFile); . . . so I think at the end that this is a server issue. This post has been edited by rockarolla: Feb 5 2008, 02:34 PM |
|
|
|
Feb 6 2008, 10:25 AM
Post
#4
|
|
|
Super Member Group: [HOSTED] Posts: 818 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:3.57 |
QUOTE(rockarolla @ Feb 5 2008, 09:32 AM) [snapback]118279[/snapback] I don't think so. Here is my code. Its a very simple code just to see if I can ever establish a connection with my database: CODE function open_connection() { $host='localhost:3307'; $user='any'; $db='my_db'; $password='my_pass'; $conn=mysql_connect($host,$user,$password); mysql_create_db ($db,$conn); mysql_select_db($db); return $conn; } If I call this function within my file I get the error: Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in As far as i know you use the port 3306 when you want to connect to a MySql host, not to the port that you specify, in this case 3307, also, you don't need to specify this on your connection scripts. So, change it to 3306 or delete from your code. Also, add to your code the mysql_error() function to check when you lost the connection and verify that in first case you get connected to the server: CODE function open_connection() { $host='localhost'; $user='any'; $db='my_db'; $password='my_pass'; $conn=mysql_connect($host,$user,$password); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_create_db ($db,$conn) or die('Could not connect: ' . mysql_error()); mysql_select_db($db); return $conn; } Another problem is that according to the PHP online manual the mysql_create_db() function is obsolete and recommends to use the mysql_query() function instead. Best regards, |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
8 | priteshgupta | 629 | Today, 03:55 PM Last post by: yordan |
|||
![]() |
5 | Feelay | 36 | Yesterday, 05:29 PM Last post by: khalilov |
|||
![]() |
10 | ganeshn11 | 1,712 | Yesterday, 10:07 AM Last post by: wutske |
|||
![]() |
7 | Herbert | 4,748 | 5th January 2009 - 04:41 PM Last post by: iG-Trem |
|||
![]() |
132 | OpaQue | 35,626 | 1st January 2009 - 03:01 PM Last post by: sakmac |
|||
![]() |
14 | ikenalleenik | 2,281 | 30th December 2008 - 01:22 PM Last post by: iG-saumyadeep |
|||
![]() |
26 | FirefoxRocks | 2,270 | 27th December 2008 - 05:47 AM Last post by: jlhaslip |
|||
![]() |
3 | FirefoxRocks | 156 | 24th December 2008 - 01:43 PM Last post by: Quatrux |
|||
![]() |
4 | FirefoxRocks | 228 | 20th December 2008 - 01:18 PM Last post by: Quatrux |
|||
![]() |
44 | cassie | 4,109 | 15th December 2008 - 02:12 AM Last post by: iG-XIEAS |
|||
![]() |
8 | nakulgupta | 2,039 | 4th December 2008 - 05:26 AM Last post by: iG-tohir |
|||
![]() |
5 | derouge | 1,541 | 30th November 2008 - 07:16 AM Last post by: iG-Rev.Keith Ratliff |
|||
![]() |
1 | xerxes | 125 | 25th November 2008 - 05:31 AM Last post by: Herbert |
|||
![]() |
13 | Feelay | 1,855 | 18th November 2008 - 09:50 AM Last post by: liod |
|||
![]() |
2 | magiccode9 | 164 | 17th November 2008 - 12:05 PM Last post by: magiccode9 |
|||
|
Lo-Fi Version | Time is now: 8th January 2009 - 07:08 PM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Feb 5 2008, 06:22 AM





