Guest User

Untitled

a guest
Jul 15th, 2018
178
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. # author:phenix3443@gmail.com
  3. # mysql connect 连接联系
  4.  
  5. import mysql.connector
  6. config = {
  7. 'user': 'root',
  8. 'password': '',
  9. 'host': '127.0.0.1',
  10. 'database': 'test',
  11. 'pool_name': 'test',
  12. 'pool_size': 32,
  13. }
  14.  
  15. cnx = mysql.connector.connect(**config)
  16. cur = cnx.cursor()
  17. cur.execute("select version()")
  18. print(cur.fetchone())
  19. cur.close()
  20. cnx.close()
Add Comment
Please, Sign In to add comment