Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import mysql.connector;
  2. from mysql.connector import errorcode;
  3.  
  4. user="root";
  5. password="toor";
  6. host="localhost";
  7. database="pydb";
  8.  
  9. try:
  10. print("Hello")
  11. conn=mysql.connector.connect('root','toor','localhost:8000','pydb');//have also tried localhost only still same error
  12. print("Hello2");
  13. mycursor=conn.cursor();
  14. print("Hello3");
  15. mycursor.execute("show tables;");
  16. print("Hello4");
  17. print(mycursor.fetchall());
  18. print("Hello5");
  19.  
  20. conn.close()
  21.  
  22. except mysql.connector.Error as err:
  23. print("Something went wrong: {}".format(err))
  24.  
  25. conn=mysql.connector.connect('root','toor','localhost:8000','pydb');
  26.  
  27. return MySQLConnection(*args, **kwargs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement