Lost connection to MySQL Server at ' reading authorization packet ', System Error:0_mysql

Source: Internet
Author: User

1. Enter mysqld

If you have set the MYSQL/BIN environment variable, enter the command directly in CMD, if you do not set the MySQL environment variable, go to the MySQL installation directory bin folder run

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

Where Root is the username and then you can enter the MySQL command line environment

2. Each subsequent MySQL command, each time with a semicolon, to end the identity, not to enter.

3. Note that every time you need to restart MySQL to make the settings effective!!

Of course, if you add the setting value directly to the MySQL installation directory My.ini, you can load the settings at MySQL startup. Like Connect_timeout = 120

And then what parameters need to be changed to solve the problem

This error often occurs when the Web server is heavily loaded,

Reason:

MySQL default connect_timeout is 5 seconds, more than this time MySQL server side will return "bad handshake".

Solution:

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

We can observe variable_name Value by executing "showstatus like ' aborted% '"
Aborted_clients 6
Aborted_connects 15010

If you feel that you want to increase the connect_timeout time, "aborted_connects" will increase as the server discards the client initial connection. If the "aborted_connects" is large and increasing, "connect_timeout" will need to be added.

2. In the MySQL configuration file [mysqld] Add "skip-name-resolve", reduce the time of domain name resolution
3. Deploying server-side networks is preferable, at least greater than 100mbps/s
4. If the problem arises when calling mysql_query, then you need to adjust the "net_read_timeout" time to 30 seconds, or 60 seconds, or greater values.
5. If the problem is not solved, it is estimated that your SQL statement contains a blob of this large type, we need to increase the value of "Max_allowed_packet"

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.