title: Python mysql: Lost connection to MySQL server during query
body: <p>I have script in python where I use MySQLdb connector, but on server MySQLdb isn't installed, so I need change connector. I have example class:</p>
  
  <pre><code>class Foo:
  
      def __init__(self, config):
          self.logger = logging.getLogger("Foo")
          self.db = MySQLdb.connect(host=config["host"],user=config["user"], passwd=config["passwd"], db=config["db"])
  
      def get_something(self):
          cursor=self.db.cursor()
          cursor.execute("Select ...")
          for row in cursor:
              self.logger.debug(row)
              yield(row)
  
  f = Foo(config)
  f.get_something()
  </code></pre>
  
  <p>When I use MySQLdb connector it works. In this case python reads all records and store in memory.
  But when I change connector to <code>mysql.connector</code> script prints some records and raise error:</p>
  
  <pre><code>mysql.connector.errors.InterfaceError: 2013: Lost connection to MySQL server during query
  </code></pre>
  
  <p>This is modified class:</p>
  
  <pre><code>class Foo:
  
      def __init__(self, config):
          self.logger = logging.getLogger("Foo")
          self.db = mysql.connector.connect(host=config["host"],user=config["user"], passwd=config["passwd"], db=config["db"])
  
      def get_something(self):
          cursor=self.db.cursor()
          cursor.execute("Select ...")
          for row in cursor:
              self.logger.debug(row)
              yield(row)
  
  f = Foo(config)
  f.get_something()
  </code></pre>
  
  <p>I try run query:</p>
  
  <pre><code>self.db.cursor().execute("SET GLOBAL max_allowed_packet=1073741824")
  </code></pre>
  
  <p>But I have error:</p>
  
  <pre><code>mysql.connector.errors.ProgrammingError: 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation
  </code></pre>
  
  <p>Is it possible to repair this error? I haven't root access to change privileges and I haven't access to install MySQLdb on server.</p>