title: Python: df.to_sql with OperationalError 1046, 'No database selected and OperationalError 2005, "Unknown MySQL server hos
body: <p>I want to change to another MySQL database (from backand) from my current one. So, I suppose it is about the way I set the database settings.</p>
  
  <pre><code>engine = create_engine('mysql+mysqldb://user:pw@backands146367311ktcttuv7')
  df_2.to_sql(name='KLSE', con=engine, if_exists='replace')
  </code></pre>
  
  <p>it returns this error</p>
  
  <pre><code>OperationalError: (_mysql_exceptions.OperationalError) (2005, "Unknown MySQL server host 'backands146367311ktcttuv7' (0)")
  </code></pre>
  
  <p>When I use another settings, </p>
  
  <pre><code>engine = create_engine('mysql+mysqldb://user:pw@bk-prod-us1.cd2junihlkms.us-east-1.rds.amazonaws.com:3306')
  df_2.to_sql(name='KLSE', con=engine, if_exists='replace')
  </code></pre>
  
  <p>It returns this error</p>
  
  <pre><code>OperationalError: (_mysql_exceptions.OperationalError) (1046, 'No database selected') [SQL: 'DESCRIBE `KLSE`']
  </code></pre>
  
  <p>Below is the MySQL database information provided</p>
  
  <pre><code>  Database Type:
      mysql
      Endpoint:
      bk-prod-us1.cd2junihlkms.us-east-1.rds.amazonaws.com:3306
      Database name:
      backands146367311ktcttuv7
  </code></pre>