Error:Lost connection to MySQL server at 'reading initial communication packet', system?

0 votes

When I try to connect to database I'm ending getting with this error:

"Lost connection to MySQL server at 'reading initial communication packet, system error: 0"

And when I am using my live IP address like below, it's getting error:

mysql_connect("202.131.xxx.106:xxxx", "xxxx", "xxxxx") or die(mysql_error())
Apr 9 in PHP by kartik
• 10,990 points
143 views

1 answer to this question.

0 votes

Hello,

You have to follow the below steps:

  1. bind-address = "YOUR MACHINE IP" in my.cnf file at /etc/my.cnf

  2. Restart service by command : service httpd restart

  3. GRANT ALL PRIVILEGES ON yourDB.* TO 'username'@'YOUR_APPLICATION_IP' IDENTIFIED BY 'YPUR_PASSWORD' WITH GRANT OPTION;

Hope this work fine!!

Thank You!

answered Apr 9 by Niroj
• 22,110 points

Related Questions In PHP

0 votes
1 answer

What is Php Mysql Database? How php connect to database?

Hello kartik, MySQL is the most popular database ...READ MORE

answered Feb 25 in PHP by Dey
90 views
0 votes
1 answer

How to include a PHP variable inside a MySQL statement?

Hii, You can try this: $query="SELECT * FROM CountryInfo ...READ MORE

answered Apr 9 in PHP by Niroj
• 22,110 points
44 views
0 votes
1 answer

I am trying to run following command But I end up with an error :

Hello Nishant, You are getting this error because your ...READ MORE

answered Apr 9 in PHP by Niroj
• 22,110 points
30 views
0 votes
1 answer

Error:SSL certificate error: unable to get local issuer certificate

Hii, If you don't have access to php.ini, adding ...READ MORE

answered Apr 15 in PHP by Niroj
• 22,110 points
65 views
0 votes
1 answer

What are the vulnerability related to PHP Form?

Hii, The $_SERVER["PHP_SELF"] variable can be used by ...READ MORE

answered Feb 13 in PHP by Niroj
• 22,110 points
67 views
+1 vote
1 answer

How can we send message multiple time to a specific person or group in whatsapp using loop?

Hii @kartik,  This is simple task to send single ...READ MORE

answered Feb 28 in Java-Script by Niroj
• 22,110 points
223 views
0 votes
1 answer

What is meant by passing the variable by value and reference in PHP?

Hello, When the variable is passed as value ...READ MORE

answered Mar 27 in PHP by Niroj
• 22,110 points
36 views
0 votes
1 answer

How to retrieve or obtain data from the MySQL database using PHP?

Hello kartik,  Actually there are many functions that  ...READ MORE

answered Mar 27 in PHP by Niroj
• 22,110 points
33 views
0 votes
1 answer

Connection with MySQL server using PHP. How can we do that?

Hey @kartik, You have to provide MySQL hostname, ...READ MORE

answered Mar 27 in PHP by Niroj
• 22,110 points
40 views
0 votes
1 answer

Error: Global Variable is not accessable to local function

Hey kartik, A variable declared outside a function has a ...READ MORE

answered Feb 19 in PHP by Niroj
• 22,110 points
36 views