6

I am trying to disable the auto reconnect feature in MySQL client by updating the my.cnf with reconnect=false in the [client] section of my.cnf. So the my.cnf looks something like this:

[mysqld]
...
interactive_timeout=30
[client]
port=3306
socket=~/dir/mysql.sock
reconnect=false

This is not working. The client times out after 30 secs but reconnects to the server.

While debugging the issue I found that the MySQL client variables are not getting set. When I ran the <dir of mysql>/bin/mysql --help, I see that the value of port, socket and reconnect flag is :

./mysql --help

port                              0
reconnect                         TRUE
socket                            (No default value)

I dont want to set the skip-reconnect from the command line. I can guess that the client configurations from my.cnf are not being exported to the client. But i need a definitive solution.

The problem is some times not replicable. There are some machines in which the change in my.cnf works fine.

Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188
Manas Shukla
  • 135
  • 1
  • 9
  • 2
    Are you sure that `my.cnf` is the one being read? Can you see it when you do `mysql --help --verbose | grep -A1 Default.options` ? Have you tried `mysql --print-defaults` to see what settings you get? Is there another file (e.g. `~/.my.cnf`) overwriting that setting? – Jeremy Smyth Nov 12 '12 at 18:21

1 Answers1

0

did you go through this ? Controlling Automatic Reconnection Behavior

Rizwan Ranjha
  • 380
  • 3
  • 4
  • 16