func (mc *mysqlConn) cleanup() {
	if mc.netConn != nil {
		if err := mc.netConn.Close(); err != nil {
			errLog.Print(err)
		}
		mc.netConn = nil
	}
	mc.cfg = nil
	mc.buf.nc = nil
}
Closes the network connection and unsets internal variables. Do not call this
function after successfully authentication, call Close instead. This function
is called before auth or on auth failure because MySQL will have already
closed the network connection.
package mysql
import (
	"database/sql/driver"
	"io"
	"net"
	"strconv"
	"strings"
	"time"
)
type mysqlConn struct {
	buf              buffer
	netConn          net.Conn
	affectedRows     uint64
	insertId         uint64
	cfg              *Config
	maxAllowedPacket int
	maxWriteSize     int
	writeTimeout     time.Duration
	flags            clientFlag
	status           statusFlag
	sequence         uint8
	parseTime        bool
	strict           bool
}
func (mc *mysqlConn) handleParams() (err error) {
	for param, val := range mc.cfg.Params {
		switch param {
		case "charset":
			charsets := strings.Split(val, ",")
			for i := range charsets {
				err = mc.exec("SET NAMES " + charsets[i])
				if err == nil {
					break
				}
			}
			if err != nil {
				return
			}
		default:
			err = mc.exec("SET " + param + "=" + val + "")
			if err != nil {
				return
			}
		}
	}
	return
}
func (mc *mysqlConn) Begin() (driver.Tx, error) {
	if mc.netConn == nil {
		errLog.Print(ErrInvalidConn)
		return nil, driver.ErrBadConn
	}
	err := mc.exec("START TRANSACTION")
	if err == nil {
		return &mysqlTx{mc}, err
	}
	return nil, err
}
func (mc *mysqlConn) Close() (err error) {
	if mc.netConn != nil {
		err = mc.writeCommandPacket(comQuit)
	}
	mc.cleanup()
	return
}