我想从我当前的数据库更改为另一个 MySQL 数据库(从 backand)。所以,我想这与我设置数据库设置的方式有关。
engine = create_engine('mysql+mysqldb://user:pw@backands146367311ktcttuv7')
df_2.to_sql(name='KLSE', con=engine, if_exists='replace')
它返回此错误
OperationalError: (_mysql_exceptions.OperationalError) (2005, "Unknown MySQL server host 'backands146367311ktcttuv7' (0)")
当我使用其他设置时,
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')
它返回此错误
OperationalError: (_mysql_exceptions.OperationalError) (1046, 'No database selected') [SQL: 'DESCRIBE `KLSE`']
下面是提供的MySQL数据库信息
Database Type:
mysql
Endpoint:
bk-prod-us1.cd2junihlkms.us-east-1.rds.amazonaws.com:3306
Database name:
backands146367311ktcttuv7