import mysql.connector
from sqlalchemy import create_engine
engine = create_engine(
    'mysql+mysqlconnector://[user]:[pass]@[host]:[port]/[schema]', echo=False)
data.to_sql(name='sample_table2', con=engine, if_exists='append', index=False)
Writing to MySQL database with pandas using SQLAlchemy, to_sql