Mysql cannot start a variety of solutions for reporting error2013 errors _mysql

Source: Internet
Author: User
Tags php database

MySQL MySQL lost connection to server during query problem resolution

Reason: In the query MySQL database, or modify the larger table when this situation occurs;
Google's:
Programme 1. Add a row of settings skip-name-resolve under the MySQL profile [MYSLQD]. The MySQL service needs to be restarted.

Programme 2 Add: IP and Host name Mapping relationship, such as: 127.0.0.1 localhost, in the Hosts file. This approach does not need to restart the MySQL service.
---------------------------
address this problem at three levels:

1. At the code level, you need to add roughly the following code to your PHP database connection.

if (In_array (Mysql_errno (), Array (2006, 2013)) {
mysql_close ();
Mysql_connect (...);
mysql_query (...);
}

In other words, encounter 2006,2013 error to reconnect to MySQL.
2. mysql level, you need to configure some parameters my.cnf (but here is Linux, what about my Windows configuration?) )
Wait_timeout = x Timeout time like 600 seconds
Max_allowed_packet = y Maximum allowable amount of data
Increase the X,y value appropriately.

3. Generally this situation is not all sample sentences but a single table, please fix the table before you can generally solve such problems.
----------------------
MySQL Error 2013:lost connection to MySQL server during query
Error code: 1153-got A packet bigger than ' Max_allowed_packet ' bytes
Workaround:
Modified Mysql.ini (online is said to be this file, looking for a long time to finally know where, my directory is in D:\MySQL_Data\MySQL Server 5.5 under the Mysql_data folder) file add the following code can
max_allowed_packet=500m


Modify F:\program\mysql5.0\my-huge.ini if you can't.

max_allowed_packet=16m 16 to 500/////////////I solved it by this method 2014-6-4 19:58//////////

The personal understanding is that the MySQL configuration provided by the maximum allowable memory to be large, after all, 16M may not be enough
I did it according to the method, try it.
----------------------
4. Can be set directly in MySQL:

#show variables like '%timeout% ';
#show variables like ' max_allowed_packet '
Set global wait_timeout=60000;
#set Global max_allowed_packet = 2*1024*1024

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.