MySQL Database pressure

Source: Internet
Author: User
Tags mysql import yii

    • Rationalerror: (2006, ' MySQL server has gone away ')
October 10, 2017 20:04:43Hits: 377Problem description

When using Django+celery, run a long task, start the database one time, and then operate the database again after 20 hours.

After more than more than 20 hours, again operation database times wrong.

Raised Unexpected:operationalerror (2006,' MySQL server has gone away ') Traceback (the most recent callLast): File"/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py",Line85,In Manager_methodReturn GetAttr (Self.get_queryset (), name) (*args, **kwargs) File"/usr/local/lib/python2.7/dist-packages/django/db/models/query.py",Line374,InchGetnum =Len (clone) File"/usr/local/lib/python2.7/dist-packages/django/db/models/query.py",Line232,In __len__ self._fetch_all () File"/usr/local/lib/python2.7/dist-packages/django/db/models/query.py",line 1118, in _fetch_all self. _result_cache = List (Self. _iterable_class (self)) File  "/usr/local/lib/python2.7/dist-packages/django/db/models/ query.py ", line 53, in __iter__ Results = Compiler.execute_sql (chunked_fetch=self.chunked_fetch) File  "/usr/local/lib/ python2.7/dist-packages/django/db/models/sql/compiler.py ", line 894, in Execute_sql raise Original_exceptionoperationalerror : (2006,  ' MySQL server has gone away ')    
Reason connection timed out

That's why I'm having problems.
Go to MySQL and execute the following command:

Mysql> Show global variables like'%timeout '; +----------------------------+----------+|variable_name |Value |+----------------------------+----------+| Connect_timeout |10 | | delayed_insert_timeout | 300 | | innodb_lock_wait_timeout | 50 | | innodb_rollback_on_timeout | off | | interactive_timeout | 28800 | | lock_wait_timeout | 31536000 | | net_read_timeout | 30 | | net_write_timeout | 60 | | slave_net_timeout | 3600 | | wait_timeout | 28800 |+----------------------------+----------+       

Wait_timeout is 28,800 seconds, that is, the MySQL link is automatically closed after 28,800 seconds of no operation

Workaround takes effect immediately

Execute the following SQL command

set global wait_timeout=60*60*30;
    • 1

The command is to set Wait_timeout to 30 hours.
In this way, the modification takes effect immediately. If you restart MySQL, restore the original 28,800 seconds.

Permanent effect

After this method has been modified, you need to restart MySQL to take effect.
Edit the MySQL configuration file my.cnf, add or modify this command as follows.
(my MySQL config file path:/etc/mysql/my.cnf)

wait_timeout = 108000
    • 1
Other reasons

There are other reasons to simply describe
1:mysql Service shutdown
2: Packet size is too large
Workaround: Modify max_allowed_packet the values as in the same way.

Copyright Notice: Text for the accumulation of the past, often forget to eat waste to sleep, hope friends pass the time note to source. 78196789Article tags: mysqldjangoceleryoperationagone-awayPersonal Category: DjangomysqlSuqian the boy at home bored play, deposit stunned parents! Xin di Technology · What does top new want to say to the author? Me a sentence MySQL import data error "error 2006 (HY000): MySQL server has gone away"

MySQL Import data Error "error 2006 (HY000): MySQL server has gone away" and MySQL Import Export command ...

ron03129596

2016-12-11 13:34:14

Hits: 3254

MySQL server has gone away problem solving method

MySQL server has gone away problem resolution submission: MDXY-DXY font: [Increase decrease] Type: Reprint time: 2010-06-05 I want to comment on MySQL ser ...

Boshuzhang

2017-06-22 14:15:15

Hits: 11980

Front-to-back, develop a full-featured applet

Development | Wanghui_777mysql importing large quantities of data appears MySQL server has gone away workaround

This article provides a solution to MySQL server has gone away, as well as the problem analysis. ...

Fdipzone

2016-07-20 23:11:11

Hits: 142419

MYSQL Error 2006:mysql Server has gone away solution

There are several scenarios for MySQL server has gone away.    1, the application (such as PHP) for a long time to execute the batch of MySQL statements.    The most common is the acquisition or conversion of old and new data. Solution: In my ...

Phphot

2008-08-19 16:36:00

Hits: 8666

ERROR 2006 (HY000): MySQL server has gone away

1. Version 1) operating system cat/etc/issue Red Hat Enterprise Linux Server release 5.5 (tikanga) Kernel \ r ...

Shaochenshuo

2015-11-24 20:09:20

Hits: 1694

YII database re-connect farewell general error:2006 MySQL server have gone away

General error:2006 MySQL server have gone away Yii Wait_timeout Manufacturing Error Resolution error reason MySQL has gone away my ...

u011042188

2016-10-21 16:24:55

Hits: 3297

The new micro-earning way, netizens: white play so many years of mobile phone Wanda Plaza Investment · Top New Error 2006 (HY000) at line Xx:mysql server have gone away

1. Execute batch MySQL statements, such as backup recovery, for a long time. Corresponding: Modify the my.cnf in the wait_timeout and interactive_timeout variables in some inconvenience to modify the situation, such as rented empty ...

Haoyuxuan

2015-04-29 09:48:39

Hits: 365

About "[MySQL ERROR (2006): MySQL server has gone away]" workaround

This error is generally due to two reasons, one is because the size of the packet sent to MySQL server exceeds the size of the parameter Max_allowed_packet set, this can be reduced by the packet or increased max_allowed_ ...

XTJSXTJ

2013-11-13 11:19:13

Hits: 1589

MySQL ERROR 2006 (HY000): MySQL server has gone away

1. Version 1) operating system cat/etc/issuered Hat Enterprise Linux Server release 5.5 (tikanga) Kernel \ r on an \m cat ...

u011666411

2018-04-25 16:50:06

Hits: 30

MySQL Error 2006 (HY000): MySQL server has gone away

MySQL when I import a larger SQL file Error 2006 (HY000): MySQL server has gone away error, as follows: > LL *.sql-rwxr ...

SELIFECN

2017-06-15 19:20:09

Hits: 258

MySQL appears 2006-mysql server has gone away problem solving method

When you import a large file's SQL statement (about 100 M), you are prompted with "2006-mysql server has gone away" error. 1 Analysis The original MySQL for the received packet is a ...

Deniro_li

2018-02-06 21:55:48

Hits: 141

Amoeba Connection Mysql--error 2006 (HY000): MySQL server has gone away

Amoeba:http://sourceforge.net/projects/amoeba/files Amoeba VERSION:AMOEBA-MYSQL-BINARY-2.1.0-RC ...

lwei_998

2012-03-05 17:55:21

Hits: 8301

Python Operations Database Operationalerror: (2006, ' MySQL server has gone away ') workaround

Using Python to connect to the MySQL database sometimes prompts Operationalerror: (2006, ' MySQL server has gone away ') error, mainly because of the Python connection to the database ...

whw1874

2013-09-02 19:16:34

Hits: 9913

[django1.6] Run Batch task error (2006, ' MySQL server has gone away ')

There is a Django timed task that invokes the Django ORM to perform data processing on the database. In an interactive environment, the direct start of the Pyhton script is not a problem, placed in a timed task, always appear (2006, ' MySQL server h ...

lzz957748332

2014-11-25 13:45:02

Hits: 5734

Pymysql.err.operationalerror: (2006, "MySQL Server has gone away (Connectionreseterror (10054, ' remote host strong

Error: Pymysql.err.operationalerror: (2006, " MySQL server has gone away (Connectionreseterror (10054 ...

u013764485

2018-05-11 09:29:42

Hits: 143

_mysql_exceptions. Operationalerror: * * (2002, "Can ' t connect to local MySQL server through socket '/V

When installing Django under Linux, Python manage.py syncdb error, Validating models ... Unhandled exception in Threa ...

Quanliyadan

2013-09-12 17:14:39

Hits: 3913

Django1.6 Error 2006 MySQL server has gone away workaround

Recently in the development of a Django project, after the need to get a lot of data from the MySQL database, the use of Django's own template system is very convenient, while the operation is much simplified, but because the volume of data is too large, resulting in every time to get data is slow to die, and then think of a way to do ...

guowei11264

2015-04-09 14:31:52

Hits: 282

When Django operates MySQL Django.db.utils.OperationalError: (2003, "Can ' t connect to MySQL Server") Error resolution

Error description Django.db.utils.OperationalError: (2003, "Can ' t connect to MySQL server on ' localhost ' (10061)" ...

xxm524

2015-08-08 17:29:23

Hits: 9242

Django Incurable diseases

1. This problem has plagued me for a long time (this is the problem with the class that is defined in models to access other business-created table with no primary key) def testrawsql (UID): from Boosencms.sina ...

Xiarendeniao

2012-05-26 15:18:58

Hits: 7801

MySQL appears error:2006, ' MySQL server has gone away '

"MySQL server has gone away" appears when you import a database by using NAVICAT to run a SQL file. Cause: The SQL statement is too large or the statement contains a BLOB or Longblob field, exceeding the default allowable maximum ...

shiyong1949

2015-07-27 15:36:52

Hits: 2150

Personal information

Win_turn

concern
Original
98
Fans
the
Like
165
Comments
About
Grade:
Access:
610,000 +
Integral:
4493
Ranking:
8794
Medal: Archive
  • 3 Articles in November 2017
  • 2 articles in October 2017
  • 1 Articles in September 2017
  • 6 Articles in August 2017
  • 14 Articles in July 2017
  • 4 Articles in June 2017
  • 2 articles in May 2017
  • 12 Articles in March 2017
  • 10 Articles in February 2017
  • 6 Articles in January 2017
  • 1 Articles in December 2016
  • 18 Articles in November 2016
  • 3 articles in September 2016
  • 2 articles in August 2016
  • 6 articles in June 2016
  • 15 articles in February 2016
  • 19 Articles in January 2016
  • 8 Articles in December 2015

Expand

Popular articles
    • Qt Creator Download and install (detailed tutorial)

      Views: 153312

    • Motherboard plug-in interface Daquan diagram

      Views: 49815

    • Visual Studio prompts you to load "C:\Windows\SysWOW64\ntdll.dll" when debugging. Unable to find or open PDB file.

      Views: 38802

    • Ubuntu Sogou IME Toggle shortcut key FCITX settings

      Views: 17229

    • Python uses requests times wrong requests.exceptions.SSLError:HTTPSConnectionPool

      Views: 16544

Latest comments
    • Backup and restore of MySQL database

      ldb987: Thank bloggers for sharing.

    • CSDN Blog How many points can be ranked

      quantum7:13 million clicks into the top 20,000, I now only hope to enter the first 30,000.

    • CSDN Blog How many points can be ranked

      Win_turn:[reply]quantum7[/reply] was csdn deleted a few articles, the heart is cold

    • CSDN Blog How many points can be ranked

      QUANTUM7: Level: 5 Visits: 570,000 + points: 4358 rank: 9037 I am now ranked 37533. Most of the processes are visible ...

    • WinRAR 5.5 Hack method-...

      u010250739: Why can not find 80:2,052, the largest only 16 ....

Contact UsPlease scan two-dimensional code contact customer service

[Email protected]

400-660-0108

QQ Customer Service Customer Service Forum

About Recruitment Advertising Service Sitemap

2018 CSDN All rights reserved Beijing ICP Certificate No. No. 09002463

Baidu provides support

Business Website Filing Information

Network 110 Alarm Service

China Internet Report Center

Beijing Internet illegal and undesirable Information Report Center

    • How much does Python pay?
    • How much does big data pay?
    • How much does AI pay?
LoginRegistered
    • 0


    • Write a review

    • Directory

    • Collection


    • Weibo

    • Qq
Shut down

MySQL Database pressure

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.