I created the my own database in azure which is now doesn't have any data. I follow this documentation to create the DB. I want to create table and access it from my machine using python. Here what I tried so far
import mysql.connector
from mysql.connector import errorcode
# Obtain connection string information from the portal
config = {
'host': '<servername>.database.windows.net',
'user': '<username>@servername.database.windows.net',
'password': '<passwword>',
'database': '<DB name>'
}
# Construct connection string
try:
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)
but when I when i run it its throwing the following error
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.
I filled the credentials with mine.
Thanks in advance
I can access from Microsoft SQL Server Management Studio
Why I can't access via Python?