MySQL超时已过期 [英] MySQL Timeout Expired

查看:81
本文介绍了MySQL超时已过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

String strcon = @"server=localhost;user id=root;password=root;database=mdagree;persistsecurityinfo=True;Connect Timeout=500";
                con = new MySqlConnection(strcon);
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                    con.Open();
                }
                else
                    con.Open();



您好,我在c#windows应用程序中使用mysql数据库进行小型自动化(自动MySQL数据库插入)应用程序。



要完成这项任务,我需要一个MySQL连接。我正在使用上面的代码进行MySQL连接这很好用,但大部分时间都会产生错误,如


Hi,i'm working in c# windows application with mysql database for small Automation(Automatic MySQL database insertion)application.

To do this task i need a MySQL Connection. i'm using the above code for MySQL connection this works well but most of the time it produces error like

引用:

超时已过期。超时在从池中获取连接之前经过了一段时间。这可能是因为所有池连接都在使用并且达到了最大池大小。;

" Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.; "

当发生此错误时,我的MySQL连接断开连接。

when this error occured my MySQL connection get disconnected.

推荐答案

增加那些使用 cmd.CommandTimeout = 900 等出现错误的命令的超时。
Increase the timeout for those commands where you are getting an error with cmd.CommandTimeout = 900 etc.


这篇关于MySQL超时已过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆