Sample Header Ad - 728x90

Client timeout connection in MySQL

0 votes
0 answers
90 views
I'm trying to limit the amount of time my MariaDB client will wait when trying to open a connection to the server. All my searches instead find only server-side limitations for timing out stale/inactive connections, nothing client-side. /etc/ssh/ssh_config, for example, has: ConnectTimeout Specifies the timeout (in seconds) used when connecting to the SSH server, instead of using the default system TCP timeout. If I try to use mysqlshow for example: # time mysqlshow && echo success || echo fail mysqlshow: Can't connect to server on 'sql.example.edu' (60) real 1m15.012s user 0m0.005s sys 0m0.007s fail If the client can't connect, I'd like it to timeout sooner than 75 seconds. Is there a knob to control this? ### Update 1 --connect_timeout=N doesn't seem to change anything: # time mariadb-show --connect_timeout=10 mariadb-show: unknown variable 'connect_timeout=10' real 0m0.007s user 0m0.000s sys 0m0.008s # time mariadb --connect_timeout=10 ERROR 2002 (HY000): Can't connect to server on 'sql.example.edu' (60) real 1m15.017s user 0m0.002s sys 0m0.014s Thank you!
Asked by Jim L. (101 rep)
Nov 4, 2024, 06:33 PM
Last activity: Nov 5, 2024, 12:19 AM