简体   繁体   中英

FireDAC Lost connection to MySQL server during query

I have two FireDAC connections on my application, one is intended to be used on a MySQL Server that is on LAN and store private data of the my shop (like sales, products, etc), and the another one is connected to a remote (internet) MySQL Server, and it randomly give me a exception

First chance exception at $745AA882. Exception class
EMySQLNativeException with message '[FireDAC][Phys][MySQL] Lost
connection to MySQL server during query'.

Is this a issue on FireDAC, my code or the remote MySQL Server? Using NAVICAT software I have no problem.

This error usually occurs because the Internet Connectivity is not stable and connection closed during exchanging data

Sometimes you can solve this issue with increasing the connection Time-Out (and ReadTimeOut )

Sometimes this error occurs because you are trying to send or receive large amount of data like Blob fields and you should increase the max_allowed_packet variable of MySQL Server to solve the problem

The next suggestion for solving this problem is avoiding dns lookup by adding skip-name-resolve to the settings of your MySQL Server

The Main reasons of this problem is connection stability and MySQL Server Settings

If you have access to MySQL server and can change the settings, this link may be useful :

http://www.monitis.com/blog/101-tips-to-mysql-tuning-and-optimization/

You can find many articles about increasing performance of MySQL Server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM