import MySQLdb db = MySQLdb.connect(db=dbname, unix_socket=dbsocket, user=dbuser, passwd=dbpass) cursor = db.cursor() cursor.execute("SELECT NOW();") d = cursor.fetchone() print("Now: ", d[0]) db.close()