Hi,
I'm working in my internship with Python and I'm trying to do a connection to a mySQL Data Base, but I have problems with following code
import pymysql
conn = pymysql.connect(host='157.159.249.172', port=3306, user='root', passwd='', db='adminOrBAC')
cur = conn.cursor()
cur.execute("""SELECT * FROM SUBJECTS """)
SUBJECTS
for r in cur.fetchall():
print r
cur.close()
conn.close()
This is the error mesage
Traceback (most recent call last):
File "C:/Users/machar_s/Desktop/TSP- CloudStack/src/it/tsp/cloudstack/orbac/test_orbac_compiler.py", line 2, in <module>
File "build\bdist.win32\egg\pymysql__init__.py", line 93, in Connect
File "build\bdist.win32\egg\pymysql\connections.py", line 513, in init
File "build\bdist.win32\egg\pymysql\connections.py", line 667, in _connect
File "build\bdist.win32\egg\pymysql\connections.py", line 720, in _request_authentication
File "build\bdist.win32\egg\pymysql\connections.py", line 765, in _send_authentication
File "build\bdist.win32\egg\pymysql\connections.py", line 194, in init
File "build\bdist.win32\egg\pymysql\connections.py", line 203, in __recv_packet
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
Process finished with exit code 1
You are in the wrong place for pymysql help.
There doesn't seem to be anything wrong with your code, so I will chalk that up to a bug in pymysql.
Log in to post a comment.
Hi,
I'm working in my internship with Python and I'm trying to do a connection to
a mySQL Data Base, but I have problems with following code
import pymysql
conn = pymysql.connect(host='157.159.249.172', port=3306, user='root',
passwd='', db='adminOrBAC')
cur = conn.cursor()
cur.execute("""SELECT * FROM
SUBJECTS
""")for r in cur.fetchall():
print r
cur.close()
conn.close()
This is the error mesage
Traceback (most recent call last):
File "C:/Users/machar_s/Desktop/TSP-
CloudStack/src/it/tsp/cloudstack/orbac/test_orbac_compiler.py", line 2, in
<module>
conn = pymysql.connect(host='157.159.249.172', port=3306, user='root',
passwd='', db='adminOrBAC')
File "build\bdist.win32\egg\pymysql__init__.py", line 93, in Connect
File "build\bdist.win32\egg\pymysql\connections.py", line 513, in init
File "build\bdist.win32\egg\pymysql\connections.py", line 667, in _connect
File "build\bdist.win32\egg\pymysql\connections.py", line 720, in
_request_authentication
File "build\bdist.win32\egg\pymysql\connections.py", line 765, in
_send_authentication
File "build\bdist.win32\egg\pymysql\connections.py", line 194, in init
File "build\bdist.win32\egg\pymysql\connections.py", line 203, in
__recv_packet
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during
query')
Process finished with exit code 1
You are in the wrong place for pymysql help.
There doesn't seem to be anything wrong with your code, so I will chalk that
up to a bug in pymysql.