Last active
July 21, 2020 05:18
-
-
Save BexTuychiev/08404f919ba487755bd336c0d216f1f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
# Store the arguments in a dictionary | |
config = { | |
'user': 'bex', | |
'password': 'my_password', | |
'database': 'db_name', | |
'host': 'host_url' | |
} | |
try: | |
# Establish a connection with remote server | |
connection = mysql.connector.connect(**config) | |
print('Connection successful!') | |
except mysql.connector.Error as error: | |
print("Something is very wrong... Getting this error:\n", error) | |
finally: | |
connection.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment