title: C# MySQL command timeout
body: <p>I have specified command_timeout for 4 seconds.</p>
  <hr />
  <p>But when I run the application, the command takes something about 8-12 seconds before it times out.</p>
  <hr />
  <p>I also specified connection timeout in MySQL connection string, but with no luck</p>
  <blockquote>
  <p>default command timeout=4</p>
  </blockquote>
  <p>It works for MsSqll and Oracle well, but for MySQL not.</p>
  <p>Is there any way how to specify the timeout?</p>
  <p>I found the issue there <a href="https://forums.mysql.com/read.php?38,634568,634568" rel="nofollow noreferrer">https://forums.mysql.com/read.php?38,634568,634568</a> but with no answer.</p>
  <h3>Edit</h3>
  <p>Code Sample</p>
  <pre><code>...         
  DataTable outputNodes = new DataTable();
  Stopwatch sw = new Stopwatch();
  cmd.CommandTimeout = 4;
  sw.Start();
  var a = cmd.ExecuteReader();
  sw.Stop();
  ex_time = sw.Elapsed;
  sw.Reset();
  outputNodes.Load(a);
  CloseConnection();
  ...
  </code></pre>