Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mysql.connector,sys
- try:
- cnx = mysql.connector.connect (host='localhost', user = 'user', password = 'user@543', port= 3306)
- except mysql.connector.errors.ProgrammingError, e:
- print time.strftime("%Y-%m-%d %H:%M:%S"),"Error %s" % (e)
- sys.exit(1)
- except mysql.connector.errors.InterfaceError, e1:
- print time.strftime("%Y-%m-%d %H:%M:%S"),"Error %s" % (e1)
- sys.exit(1)
- cursor = db.cursor()
- cursor.execute("select version()")
- result_set = cursor.fetchall()
- print result_set
- Traceback (most recent call last):
- File "test.py", line 3, in <module>
- cnx = mysql.connector.connect (host='localhost', user = 'user', password = 'user@543', port= 3306)
- AttributeError: 'str' object has no attribute 'connector'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement