Guest User

Untitled

a guest
Jul 15th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. # -*- coding:utf-8 -*-
  2. # mysql connect 连接联系
  3.  
  4. import mysql.connector
  5. config = {
  6. 'user': 'root',
  7. 'password': '',
  8. 'host': '127.0.0.1',
  9. 'database': 'test',
  10. 'pool_name': 'test',
  11. 'pool_size': 32,
  12. }
  13.  
  14. cnx = mysql.connector.connect(**config)
  15. cur = cnx.cursor()
  16. cur.execute("select version()")
  17. print(cur.fetchone())
  18. cur.close()
  19. cnx.close()
Add Comment
Please, Sign In to add comment