- 论坛徽章:
- 0
|
本帖最后由 ilikeqdi 于 2012-04-24 17:11 编辑
#!/usr/bin/python
import MySQLdb
db=MySQLdb.connect(host="localhost",user="root",passwd="",db='test')
cursor=db.cursor()
cursor.execute(r'show databases \G;')
result=cursor.fetchall()
cursor.close()
print result
Traceback (most recent call last):
File "./test.py", line 5, in ?
cursor.execute(r'show databases \G;')
File "build/bdist.linux-i686/egg/MySQLdb/cursors.py", line 174, in execute
File "build/bdist.linux-i686/egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\\G' at line 1")
换成cursor.execute('show databases \\G;')
还是不行
谁有什么好办法?? |
|