我在天蓝色中创建了自己的数据库,但现在没有任何数据。我按照此文档创建数据库。我想创建表并使用 python 从我的机器访问它。到目前为止我尝试过的import mysql.connectorfrom mysql.connector import errorcode# Obtain connection string information from the portalconfig = { 'host': '<servername>.database.windows.net', 'user': '<username>@servername.database.windows.net', 'password': '<passwword>', 'database': '<DB name>'}# Construct connection stringtry: conn = mysql.connector.connect(**config) print("Connection established")except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("Something is wrong with the user name or password") elif err.errno == errorcode.ER_BAD_DB_ERROR: print("Database does not exist") else: print(err)但是当我运行它时它会抛出以下错误9002 (28000): The server name you tried cannot be found: <servername>.database.windows.net. Please check the Username and retry connection. The Username should be in <username@hostname> format.我用我的凭证填写了凭证。提前致谢我可以从 Microsoft SQL Server Management Studio 访问为什么我无法通过Python访问?
添加回答
举报
0/150
提交
取消