title: MySQL (mariaDB) Connection Error with SqlAlchemy
body: <p>Hello I have a mariaDB database on a Ubuntu server running in a virtual box.
  With 'Sequal Pro' i can connect without any problems (with the ssh option).
  Port forwarding like this: HOST 127.0.0.1 3306 GAST 10.0.2.15 3306</p>
  
  <p>But in my python application i can't connect, or better it lost the connection before it can do something, with the following error: </p>
  
  <blockquote>
    <p>OperationalError: (OperationalError) (2013, 'Lost connection to MySQL
    server during query') None None</p>
  </blockquote>
  
  <p>I use SqlAlchemy with the mysqldb connector, like this:
  In the <strong>init</strong>.py file in models directory:</p>
  
  <pre><code># for this must install pymsql (pip install pymysql)
  DATABASE = 'mysql+pymysql://&lt;user&gt;:&lt;password&gt;@127.0.0.1/fist-test'
  
  app.debug = DEBUG
  app.secret_key = 'secret-key123'
  app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE
  db = SQLAlchemy(app)
  </code></pre>
  
  <p>In the project main directory in the main.py file:</p>
  
  <pre><code>from models import db
  
  @app.route('/test')
  def test():
      db.create_all()
      return 'create objects...'
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>In models is also some model class:</p>
  
  <pre><code>from sqlalchemy import Column, Integer, String
  
  class User(Base):
       __tablename__ = 'users'
  
       id = Column(Integer, primary_key=True)
       name = Column(String)
       fullname = Column(String)
       password = Column(String)
  
       def __init__(self, name, fullname, password):
           self.name = name
           self.fullname = fullname
           self.password = password
  
       def __repr__(self):
          return "&lt;User('%s','%s', '%s')&gt;" % (self.name, self.fullname, self.password)
  </code></pre>
  
  <p>Hope someone can help me to understand and solve the problem.</p>
  
  <p>Thanks for your time!</p>