OperationalError: 2013: Lost connection to MySQL server during query

import singlestoredb as s2
s2_connection = s2.connect(host=host,
port=port,
user=user,
password=password,
database=database,
results_format=‘dataframe’)

with s2_connection:
with s2_connection.cursor() as cursor:
print(‘Is databases connected now:’, cursor.is_connected())
cursor.execute(query)
df = cursor.fetchall()

I tried to run the code above but it stops after 10 seconds and gives me below.
OperationalError: 2013: Lost connection to MySQL server during query

Does it have anything to do what the timeout setting? Thanks.

Hi Leo! Welcome aboard :wave:

Are you running the managed or self-hosted service?
What version?
What connector/library are you using?

Where do you connect from?

Can somebody help? I am having the same issue:

I have a python code that connects to Singlestore and runs a couple of queries:
conn = mysql.connector.connect(host=host, user=user, password=password, database=database)
if conn.is_connected():
try:
cursor = conn.cursor(buffered=True)
cursor.execute(‘DROP ALL FROM PLANCACHE’)
cursor.execute(queries[i])
res_fetchall = cursor.fetchall()
except Exception as e:
print(repr(e))

it connects to the database, and begins running (I can see in the active queries), however, after a few queries:
InterfaceError(2013, ‘2013: Lost connection to MySQL server during query’, None)
Retry after 5 sec
Connected
OperationalError(-1, ‘MySQL Connection not available.’, None)
Retry after 5 sec
Connected
OperationalError(-1, ‘MySQL Connection not available.’, None)
Retry after 5 sec
Connected
OperationalError(-1, ‘MySQL Connection not available.’, None)
Retry after 5 sec
Connected
OperationalError(-1, ‘MySQL Connection not available.’, None)
Retry after 5 sec

It loses the connection and even if I retry the connection it says it is not available.
Does anyone know what is happening?

Facing a similar issue running in a Singlestore cloud environment. Were you able to identify what causes this issue?