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, 2020 in PHP by kartik
• 37,520 points
20,985 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!

To know more about SQL, It's recommended to join MS SQL Course today.

answered Apr 9, 2020 by Niroj
• 82,880 points

Related Questions In PHP

0 votes
0 answers

PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client

I'm running MySQL version 8 on PHP ...READ MORE

Jun 18, 2022 in PHP by narikkadan
• 63,680 points
1,151 views
0 votes
2 answers

Error:“Cannot Connect to Server - A network-related or instance-specific error”?

Hello, The "sql server error 40" is appears mostly ...READ MORE

answered Aug 18, 2020 in PHP by Fantazma
• 140 points
29,262 views
0 votes
1 answer

Error:Cannot connect to database server Communications link failure

Hello @kartik, Setting the bind-address to the server's network IP ...READ MORE

answered Aug 19, 2020 in PHP by Niroj
• 82,880 points
1,205 views
0 votes
1 answer

How to grant remote access permissions to mysql server for user?

Hello @kartik, This grants root access with the ...READ MORE

answered Aug 26, 2020 in PHP by Niroj
• 82,880 points
5,102 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, 2020 in PHP by Niroj
• 82,880 points
3,147 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, 2020 in Java-Script by Niroj
• 82,880 points
18,538 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, 2020 in PHP by Niroj
• 82,880 points
3,244 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, 2020 in PHP by Niroj
• 82,880 points
1,278 views
0 votes
1 answer

Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 9

Hello @kartik, Replace TYPE=MyISAM with ENGINE=MyISAM The problem was "TYPE=MyISAM" which should ...READ MORE

answered Nov 16, 2020 in PHP by Niroj
• 82,880 points
11,299 views
0 votes
1 answer

Error: Can't connect to MySQL server on 'my.application.com' (10061)

Hello @kartik, To directly login to a remote ...READ MORE

answered Aug 19, 2020 in PHP by Niroj
• 82,880 points
1,940 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP