How to fix "2013.Lost connection to mysql server during query" - mysql

At the moment I am working with MySql database using PyMySql(python).
So, when I am sending many requests to my DB, I face the error:
Error Code: 2013. Lost connection to MySQL server during query
If I am trying to get the Information again I face this error:
InterfaceError (0, '')
Here is my code:
with connection.cursor() as cur:
userId = message.from_user.id
cur.execute(f"INSERT INTO UserInfo(UserId, Favourites) VALUES ({message.from_user.id}, 'None');")
connection.commit()
cur.close()
I had already tried changing settings in MySqlWorkbench following those advises. My settings now.
And my code is like in this question.
So, What should I do to deal with this problem?

Related

django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')

I create a django app to shared hosting. Everything is good but when i came to createsuperuser i see this problem...
I made lots of things, i increased connect timeout and read timeout but nothing changed.
How can i solve this?
i made connect_timeout=100000,
i made read_timeout=120,
i tried to shell for create super user, i wrote username, no error, i wrote email, no error, i wrote pass and i got this error....

How to connect a mysql server to grafana?

I'm new on grafana and I need to connect my database (mysql) to it.
I tried to configure the custom.ini file as follow,
I added the next section on database
#################################### Database
####################################
type = mysql
host = localhost:3306
name = grafana (db on my sql server)
user = grafana (user on my sql server)
#### If the password contains # or ; you have to wrap it with triple quotes.
Ex “”"#password;"""
password =***** (password of my sql user)
and the next section on session
#################################### Session ####################################
[session]
provider = mysql (at the beginning)
provider_config = grafana:*******#tcp(localhost:3306)/grafana
provider = mysql (at the end)
When I try to connect to the serve I get this error : “Service init failed: Migration failed err: this authentication plugin is not supported”
I’m new on grafana and I don’t know if I have to set more thinks in the custom.ini
If someone can figure out what is wrong here I will be the happiest man on the world :D
Thanks for the time you spent reading this and a big big thanks to the savior !!
I finally find the problem. The fact is that mysql 8 has some permission faeture which brings a lot of issue for connecting to grafana or read files. So I install mysql 5.7 instead and all was fine !

Unable to Create a Table in MySQL Database (Error Code: 2013. Lost connection to MySQL server during query)

I am unable to create a Table in one of the databases in MySQL. In the same MySQL Server, I can create a table in other databases. I am getting an error code as below.
Error Code: 2013. Lost connection to MySQL server during query
Can someone please help at the earliest.
This is what I found on quick google search
Error Code: 2013. Lost connection to MySQL server during query
https://dev.mysql.com/doc/refman/5.7/en/error-lost-connection.html

Getting error when creating connection to MySQL server driver

I installed MySQL server and I also test this server by creating user data base userlist table and also check that it is working fine on command line as I previously done. But This time getting error when try to create a user.
I already used this but actauly I format my system and creating connection again. But this time getting error.

Error in configuring MySql workbench - Failed to connect to MySql at localhost

I am new to MySql workbench and never needed to use a lot of DBs before now.
I had an sql script containing all the DB creation, tables, population etc.
So using MySql workbench, I Reversed Engineering Using a Create Script.
Fine, it worked as I can see my tables.
Now I want perform some select over my data and I first need to create a new connection,
So I tried to Creating a MySQL Connection
but when I test the connection, I get the following error: "Failed to connect to MySql server on 127.0.0.1" (10061).
Question: what to use in the below menu (Connection/RemoteManagement/System Profile) or what else could be my problem?
my problem was that I didnt have a db, so I decided to use wampserver which includes everything and it's very simple to use.