Fixed connection idle timeout for mysql adapter

Also added limit for reconnections.