Guest User

Untitled

a guest
Dec 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. def connect():
  2. print("Connecting to MySQL dayabase")
  3. try:
  4. conn = mysql.connector.connect(host='MYHOST',
  5. database='MYDB,
  6. user='MYUSERNAME',
  7. password='MYPASSWORD')
  8. if conn.is_connected():
  9. print("Connected to MySQL database")
  10.  
  11. except Error as e:
  12. print(e)
  13.  
  14. finally:
  15. conn.close()
Add Comment
Please, Sign In to add comment