示例#1
0
// InitConnectionParams may overwrite the socket file,
// and refresh the password to check that works.
func InitConnectionParams(cp *mysql.ConnectionParams, socketFile string) error {
	if socketFile != "" {
		cp.UnixSocket = socketFile
	}
	params := *cp
	return refreshPassword(&params)
}
示例#2
0
文件: mysqld.go 项目: qinbo/vitess
func NewMysqld(config *Mycnf, dba, repl *mysql.ConnectionParams) *Mysqld {
	if *dba == dbconfigs.DefaultDBConfigs.Dba {
		dba.UnixSocket = config.SocketFile
	}

	return &Mysqld{config,
		dba,
		repl,
		TabletDir(config.ServerId),
		SnapshotDir(config.ServerId),
	}
}
示例#3
0
文件: mysqld.go 项目: miffa/vitess
// NewMysqld creates a Mysqld object based on the provided configuration
// and connection parameters.
// name is the base for stats exports, use 'Dba', except in tests
func NewMysqld(name string, config *Mycnf, dba, repl *mysql.ConnectionParams) *Mysqld {
	if *dba == dbconfigs.DefaultDBConfigs.Dba {
		dba.UnixSocket = config.SocketFile
	}

	// create and open the connection pool for dba access
	mysqlStats := stats.NewTimings("Mysql" + name)
	dbaPool := dbconnpool.NewConnectionPool(name+"ConnPool", *dbaPoolSize, *dbaIdleTimeout)
	dbaPool.Open(dbconnpool.DBConnectionCreator(dba, mysqlStats))

	return &Mysqld{
		config:      config,
		dba:         dba,
		dbaPool:     dbaPool,
		replParams:  repl,
		TabletDir:   TabletDir(config.ServerId),
		SnapshotDir: SnapshotDir(config.ServerId),
	}
}
示例#4
0
文件: mysqld.go 项目: rjammala/vitess
func NewMysqld(config *Mycnf, dba, repl mysql.ConnectionParams) *Mysqld {
	if dba == DefaultDbaParams {
		dba.UnixSocket = config.SocketFile
	}

	// the super connection is not linked to a specific database
	// (allows us to create them)
	superParams := dba
	superParams.DbName = ""
	createSuperConnection := func() (*mysql.Connection, error) {
		return mysql.Connect(superParams)
	}
	return &Mysqld{config,
		dba,
		repl,
		createSuperConnection,
		TabletDir(config.ServerId),
		SnapshotDir(config.ServerId),
	}
}