我有一个python脚本来获取mysql版本,但是我一直得到相同的错误“\umysql_异常。接口错误:(0,“”)
我去了python2.7控制台,也尝试了同样的方法import MySQLdb
conn = MySQLdb.connect (host="localhost",user="user", passwd="pass", db="example")
cursor = conn.cursor()
cursor.execute ("SELECT VERSION()")Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.InterfaceError: (0, '')
文件呢
^{pr2}$
在[用户@localhost]$python b.pyError 0:
Traceback (most recent call last):
File "b.py", line 18, in
conn.close()
_mysql_exceptions.ProgrammingError: closing a closed connection
谢谢