Lost connection to MySQL server at 'reading authorization packet ', system error: 0, mysqlconnection

Source: Internet
Author: User

Lost connection to MySQL server at 'reading authorization packet ', system error: 0, mysqlconnection

1. Enter Mysqld

If the Mysql/Bin environment variable has been set, enter the command directly in CMD. If the Mysql environment variable is not set, run it in the Bin folder of the Mysql installation directory.

F: \ AppServ \ MySQL \ bin \ mysql.exe-u root-p

Root is the user name, and then you can enter the Mysql command line environment.

2. For each Mysql command in the future, the semicolon should be used each time, instead of the carriage return.

3. Note that you need to restart Mysql every time to make the settings take effect !!

Of course, if you directly add the setting value to my. ini in the Mysql installation directory, you can load the setting at Mysql startup. Such as connect_timeout = 120

Then, what parameters need to be modified to solve this problem?

This error often occurs when the WEB server load is high,

Cause:

MySQL uses connect_timeout for 5 seconds by default. After this time, the MySQL server returns "Bad handshake ".

Solution:

1. Most of the time setting "set global connect_timeout = 60;" can solve the problem;

We can execute "showstatus like 'aborted % '" To observe the Variable_name Value.
Aborted_clients 6
Aborted_connects 15010

If you want to increase the connect_timeout time, "Aborted_connects" will increase as the server abandons the initial connection of the client. If "Aborted_connects" is large and increases, you need to add "connect_timeout ".

2. Add "skip-name-resolve" in the MySQL configuration file [mysqld] to reduce domain name resolution time
3. Better network for deploying servers, at least 100 Mbps/s
4. If the problem occurs when calling mysql_query, you need to set the "net_read_timeout" time to 30 seconds, 60 seconds, or a larger value.
5. If the problem persists, it is estimated that your SQL statement contains the BLOB type. We need to add the value of "max_allowed_packet ".


Why does the following error occur when inserting data into MYSQL? Teach prawns

This error often occurs when the WEB server load is high,

Cause:

MySQL uses connect_timeout for 5 seconds by default. After this time, the MySQL server returns "Bad handshake ".

Solution:

1. Most of the time setting "set global connect_timeout = 60" can solve the problem;
We can execute "show status like 'aborted % '" To observe
Variable_name Value
Aborted_clients 6
Aborted_connects 15010

If you want to increase the connect_timeout time, "Aborted_connects" will increase as the server abandons the initial connection of the client. If "Aborted_connects" is large and increases, you need to add "connect_timeout ".

2. Add "skip-name-resolve" in the MySQL configuration file [mysqld] to reduce domain name resolution time

3. Better network for deploying servers, at least 100 Mbps/s

4. If the problem occurs when calling mysql_query, you need to set the "net_read_timeout" time to 30 seconds, 60 seconds, or a larger value.

5. If the problem persists, it is estimated that your SQL statement contains the BLOB type. We need to add the value of "max_allowed_packet ".

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

Start the mysql service in the service, right-click my computer, choose "manage"> "services and applications"> "find mysql"> "right-click" properties ">" start"

Can you go in to the command line? Your password is incorrect.

Regardless of the path used for remote access, the system may be deemed to have firewall restrictions. The solution is to add a startup parameter in the [mysqld] section of my. cnf.

Skip-name-resolve


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.