title: How to set MySQLdb Connection timeout to infinity in python
body: <p>I am doing some task on database after every 10 hours . I have connected to database only one time at the start of the script. after 10 hours database connection gets timeout.
  I can use other method here but i want to know that how to set Connection timeout to infinity . After 10 hours i am getting an error which is given below .</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>import MySQLdb,time
  
  db = MySQLdb.connect("hostname", "user", "password", "db_name")
  
  while True:
      db.commit() # to refresh database
      cursor = db.cursor()
      cursor.execute("some query here") 
      db.commit()
      cursor.close() 
      time.sleep(36000)# Wait for 10 hours
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <blockquote>
    <p>OperationalError: (2006, 'MySQL server has gone away')</p>
  </blockquote>