#🔒 Python MySQL Timeout 10054 Error

20 messages · Page 1 of 1 (latest)

versed stag
#

Traceback (most recent call last):
File "c:/Users/Sergen/Desktop/EMRE SENİN DOSYALAR/python-tools/mysql-insert.py", line 12, in <module>
query.execute(insert_okulno)
File "C:\Users\Sergen\AppData\Local\Programs\Python\Python38\lib\site-packages\pymysql\cursors.py", line 153, in execute
result = self._query(query)
File "C:\Users\Sergen\AppData\Local\Programs\Python\Python38\lib\site-packages\pymysql\cursors.py", line 322, in _query
conn.query(q)
File "C:\Users\Sergen\AppData\Local\Programs\Python\Python38\lib\site-packages\pymysql\connections.py", line 557, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "C:\Users\Sergen\AppData\Local\Programs\Python\Python38\lib\site-packages\pymysql\connections.py", line 872, in _execute_command
self.write_packet(sql[:packet_size])
File "C:\Users\Sergen\AppData\Local\Programs\Python\Python38\lib\site-packages\pymysql\connections.py", line 727, in write_packet
self._write_bytes(data)
File "C:\Users\Sergen\AppData\Local\Programs\Python\Python38\lib\site-packages\pymysql\connections.py", line 806, in _write_bytes
raise err.OperationalError(
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(10054, 'Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı', None, 10054, None))")

import pymysql

sql_file = open(r"C:\Users\Sergen\Desktop\EMRE SENİN DOSYALAR\python-tools\numaralar.sql", "r", encoding = "utf-8")


insert_okulno = sql_file.read()

con = pymysql.connect(host = "localhost", user = "root", password = "", database = "eokulno")

query = con.cursor()

query.execute(insert_okulno)

con.commit()

print(query.rowcount, "record(s) affected")

I get this error when I try to read a file with high data. Does anyone have any information?

candid garnetBOT
#

@versed stag

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

dense igloo
versed stag
#

problem its mysql.

#

but i don't know, where is problem.

dense igloo
versed stag
#

wdym?

dense igloo
#

Probably the connection object query has some issue

versed stag
#

there is problem insert to database.

#

i try it normal insert thats work.

#

but another file insert db doesn't work.

dense igloo
versed stag
versed stag
dense igloo
# versed stag like this.

This is single query that occupies multiple lines
I mean to ask that there are multiple such queries ?

candid garnetBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.