Bug #47311 mysqldump lacks parameters net_read_timeout and net_write_timeout
Submitted: 14 Sep 2009 15:19
Reporter: Andrii Nikitin Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:5.0, 5.1 OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[14 Sep 2009 15:19] Andrii Nikitin
Description:
The only way to set required net_read_timeout and net_write_timeout variables for mysqldump is setting them at GLOBAL level, which will work, but affects other connections, so is not always acceptable.

How to repeat:
1. set global net_write_timeout=1
2. start mysqldump with TCP connection some pipe which will delay output. E.g. "less -b1" will read only first kilobyte of output:

mysqldump -h127.0.0.1 -P3306| less -b1

3. scroll down ~1Kb of output until message "mysqldump: Error 2013: " is printed. (line ~50 if first table in output is big enough)

(Also optionally see SHOW PROCESSLIST will display mysqldump connection for global.net_write_timeout seconds).

Suggested fix:
Add parameters --net_write_timeout and --net_read_timeout to mysqldump, which will set session level variables if specified.

Or, better, add new parameter "SQL initialization string" so user will be able to set up these or other parameters for mysqldump.

Workaround should be using Unix socket file, because the manual states net_write_timeout is not applicable to Unix sockets
[25 Aug 2011 21:01] Sheeri Cabral
I'd like to see this feature too.  something like --set 'foo=bar'
[26 Aug 2011 15:32] Shane Bester
I assume mysqldump and mysql client would just need to call mysql_options() with the MYSQL_OPT_READ_TIMEOUT and MYSQL_OPT_WRITE_TIMEOUT values specified, before making the connection.
[26 Aug 2011 15:33] Shane Bester
Would also be nice to pick these values from [mysql], [mysqldump], [client] section?
[20 Mar 2014 11:35] Melvyn Sopacua
Please update version to include at least 5.5.29. And it's a shame this hasn't been picked up yet. When copying data from server to server this is a big issue and the dreaded MySQL server has gone away surfaces. Took me a while to notice it was mysqldump (the sender) and not mysql (the receiver) that had the problem.
[19 Sep 2018 18:39] Jesús Uzcanga
MySQL 5.7.22 and still having issues with mysqldump and big tables.