0

您好,我正在尝试使用 Python 脚本在 Azure MySQL 数据库上连接并执行一些语句。要建立连接,我使用以下代码:

从 sqlalchemy 导入 create_engine 导入 pandas 作为 pd

db_engine = create_engine(db_connection_string) example_data_frame = pd.read_sql(sql = 'SELECT 1', con=db_engine)

我使用的连接字符串格式为:'mysql+pymysql://login:password@server_ip:port/DB_name'

我在其他非 Azure 数据库上尝试过它,它运行良好,但是现在我收到此错误:

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (9002, 'FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in username@hostname format.\x00') (此错误的背景在: http ://sqlalche.me/e/14/e3q8 )

您可能知道解决方案吗?

4

0 回答 0