__MagicPower
Do one thing and do it best!

导航

 
#!/usr/bin/env python
#--*-- coding:utf-8 --*--
__author__ = 'Kevin'

import MySQLdb as mdb

con = None

try:
    con = mdb.connect('localhost','root','redhat','test')
    cur = con.cursor()

    cur.execute("SELECT VERSION()")
    data = cur.fetchone()
    print "Database version: %s" % data
finally:
    if con:
        con.close()

 

Result:


Database version: 5.6.27

posted on 2016-01-05 13:20  __MagicPower  阅读(113)  评论(0编辑  收藏  举报