Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  agyat : (23 May 2013 - 01:23 AM) Wow! Mr. Sb Back Home.
@  OpaQue : (23 May 2013 - 12:44 AM) Ting
@  OpaQue : (24 April 2013 - 02:44 PM) I guess, Time to run Mycent script.
@  OpaQue : (24 April 2013 - 02:43 PM) wow.. not much spam. except habatt posting lot of links.. :P
@  yordan : (23 April 2013 - 01:04 PM) You're welcome, agyat. Nice to have been helpful. Second lesson: try full words, "you" instead of "EW".
@  agyat : (23 April 2013 - 05:03 AM) @YORDAN: tHANK EW FOR YOUR FIRST LESSON.   :D
@  yordan : (22 April 2013 - 09:43 PM) @agyat : "why don't you help me", or "please help me", or "please teach us"
@  yordan : (22 April 2013 - 09:42 PM) welcome back, velma
@  velma : (22 April 2013 - 07:51 AM) **yawns** Good to be back, wonder what is going on here :)
@  agyat : (22 April 2013 - 03:50 AM) Oh! so, why don't help me learn english..
@  yordan : (21 April 2013 - 08:38 PM) The goal mentioned by shiu : "learning english, learning computer"
@  agyat : (21 April 2013 - 06:31 PM) WHAT GOAL?
@  yordan : (20 April 2013 - 10:39 AM) yes, that's our goal. simultaneouly learning English and teaching/learning computer using.
@  shiyu : (20 April 2013 - 07:30 AM) learning english,learning computer
@  yordan : (19 April 2013 - 01:11 PM) Oh, I see, it's just a trick in order to force people looking at your texte. Somehow smart, maybe.
@  agyat : (19 April 2013 - 02:54 AM) And of course I know it is not SEO friendly.
@  agyat : (19 April 2013 - 02:52 AM) There may be two possible answers for that ....


1) Shout was posted using mobile keypad.

2) To force people read content carefully and/or with more concentration.
@  agyat : (19 April 2013 - 02:49 AM) There may be two possible answers for that ....
@  yordan : (18 April 2013 - 09:35 PM) however, why this mixing of capital letters in the middle of your text?
@  agyat : (18 April 2013 - 11:10 AM) false feelings.

Replying to Lost Connection To Mysql ,..., System Error: 111 In


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

TavoxPeru

Posted 06 February 2008 - 10:25 AM

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:

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:
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,

rockarolla

Posted 05 February 2008 - 02:32 PM

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:

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:

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.

yordan

Posted 05 February 2008 - 09:48 AM

If you can access your database through cpanel and PHPMyAdmin, it's not a server issue. So, the issue is inside your php program.

rockarolla

Posted 05 February 2008 - 06:22 AM

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?

Review the complete topic (launches new window)