我在天藍色中創建了自己的數據庫,但現在沒有任何數據。我按照此文檔創建數據庫。我想創建表并使用 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訪問?
無法使用 python 從我的計算機訪問 Azure SQL DB
慕桂英4014372
2023-10-11 20:09:59