title: Can we create multiple MySQL Instances in one flask application?
body: <p>I have two databases say xyz and abc. The thing is I want to have two MySQL instances using one Flask app. 
  This is how I initialize one MySQL Instance:</p>
  
  <pre><code>app = Flask(__name__)
  app.config['MYSQL_HOST']='localhost'
  app.config['MYSQL_USER']='root'
  app.config['MYSQL_PASSWORD']='abcd'
  app.config['MYSQL_DB'] = 'xyz'
  mysql_xyz = MySQL(app)
  </code></pre>
  
  <p>I have another database lets say 'abc'
  when I am trying to overwrite 'MYSQL_DB' by:</p>
  
  <pre><code>app.config['MYSQL_DB'] = 'abc'
  mysql_abc = MySQL(app)
  </code></pre>
  
  <p>I am getting the following error: </p>
  
  <blockquote>
    <p>Debugging middleware caught exception in streamed response at a point
    where response headers were already sent. MySQLdb._exceptions.OperationalError: (2006, '')</p>
  </blockquote>
  
  <p>However, another alternative is to create a different app altogether under the same script file app.py </p>
  
  <pre><code>app1 = Flask(__name__)
  app1.config['MYSQL_HOST']='localhost'
  app1.config['MYSQL_USER']='root'
  app1.config['MYSQL_PASSWORD']='abcd'
  app1.config['MYSQL_DB'] = 'abc'
  mysql_abc = MySQL(app1)
  </code></pre>
  
  <p>and this works fine. 
  can anyone please let me know how can I overwrite the value of 'MYSQL_DB' config and create another mysql instance using only one app variable. </p>