亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法使用 python 從我的計算機訪問 Azure SQL DB

無法使用 python 從我的計算機訪問 Azure SQL DB

慕桂英4014372 2023-10-11 20:09:59
我在天藍色中創建了自己的數據庫,但現在沒有任何數據。我按照此文檔創建數據庫。我想創建表并使用 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訪問?
查看完整描述

1 回答

?
嚕嚕噠

TA貢獻1784條經驗 獲得超7個贊

我認為你誤解了SQL并且MySQL

SQL您正在嘗試使用連接器訪問數據庫MySQL。那是不可能的。


查看完整回答
反對 回復 2023-10-11
  • 1 回答
  • 0 關注
  • 104 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號