(mysql.info.gz) mysql reconnect
Info Catalog
(mysql.info.gz) safe-updates
(mysql.info.gz) mysql Tips
8.3.3.3 Disabling `mysql' Auto-Reconnect
........................................
If the `mysql' client loses its connection to the server while sending
a query, it will immediately and automatically try to reconnect once to
the server and send the query again. However, even if `mysql' succeeds
in reconnecting, your first connection has ended and all your previous
session objects and settings are lost: temporary tables, the autocommit
mode, and user and session variables. This behavior may be dangerous
for you, as in the following example where the server was shut down and
restarted without you knowing it:
mysql> SET @a=1;
Query OK, 0 rows affected (0.05 sec)
mysql> INSERT INTO t VALUES(@a);
ERROR 2006: MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 1
Current database: test
Query OK, 1 row affected (1.30 sec)
mysql> SELECT * FROM t;
+------+
| a |
+------+
| NULL |
+------+
1 row in set (0.05 sec)
The `@a' user variable has been lost with the connection, and after the
reconnection it is undefined. If it is important to have `mysql'
terminate with an error if the connection has been lost, you can start
the `mysql' client with the `--skip-reconnect' option.
Info Catalog
(mysql.info.gz) safe-updates
(mysql.info.gz) mysql Tips
automatically generated byinfo2html