Lost connection to MySQL server during query on remote host

只愿长相守 提交于 2019-12-25 06:43:22

问题


I'm working with cppcms framework with cppdb and mysql and got "Lost connection to MySQL server during query" error when trying to make a query on a remote database.

I also have the same database locally, and the app works ok with that one.

Remote mysql version: mysqld Ver 5.5.29-0ubuntu0.12.10.1 for debian-linux-gnu on i686 ((Ubuntu))

Thanks for your help


回答1:


Two questions:

  • Do you use connection pooling?
  • Do you destroy cppdb::session object when you done using it or you are keeping it active all the time?

If you keep cppdb::session all the time you probably not need to do it because MySQL closes idle connections after certain time period. It is better to use connection pooling provided by CppDB.

If you are already using connection pooling try to change the @pool_max_idle parameter to smaller value.

See: http://cppcms.com/sql/cppdb/connstr.html#speckeys for more details



来源:https://stackoverflow.com/questions/15102878/lost-connection-to-mysql-server-during-query-on-remote-host

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!