2

Sometimes the error "Mysql server has gone away" pops up. Sometimes "Lost connection to MySQL server during query" pops up.

I had previously developed a database in Access and wrote a form for it in Delphi - everything worked perfectly. Now I developed a database on MySQL (using the Open Server), wrote a form. When I work in the application, these errors periodically pop up. They are not tied to any action (I do different actions - there are no errors. Then one of them appears). I attach a screenshot of the errors.

How to fix it?

enter image description here enter image description here

user153742
  • 313
  • 2
  • 17
  • 1
    Could be a few things. Other than the obvious (your connection dropped - catch this exception and attempt to reconnect), it could also be that you need to adjust the [maximum allowed packet size](https://stackoverflow.com/a/9479681/327083). We don't have enough information to debug with just this message alone. The code you're using as well as some information about the size of records, etc, you are retrieving would be useful. – J... Jun 25 '19 at 17:13
  • 1
    see also : [ERROR 2006 (HY000): MySQL server has gone away](https://stackoverflow.com/q/10474922/327083), [MySQL Server has gone away when importing large sql file](https://stackoverflow.com/q/12425287/327083) – J... Jun 25 '19 at 17:14
  • 2
    I can't see your error messages, because imgur is blocked by our corporate proxy (one of the many reasons that images should not be used for code or error message content). Please post the error information as text. If the content is in a Delphi exception dialog, you can simply hit Ctrl+C with the dialog displayed and a text copy will be placed in the clipboard for you, which can be pasted directly into your post here. – Ken White Jun 25 '19 at 20:10

1 Answers1

2

I found the answer. It was necessary for the element FDConnection to set a tick in the Object Inspector: Resource Options -> AutoReconnect -> true.

user153742
  • 313
  • 2
  • 17