def setVariable(instance_name, variable, value): cnf = getCNF(instance_name) if path.exists(cnf): mc = MySQLDConfig(cnf) cur = connMySQLd(mc) cur.execute("set global %s = %s" % (variable, value)) mc.set_var(variable, value) mc.save()
def createInstance(name, port): cnf = path.join(MYSQL_CONF_DIR, "%s.cnf" % name) datadir = path.join(MYSQL_DATA_DIR, name) exists_cnfs = readConfs() if checkPort(exists_cnfs, port): print >>sys.stderr, "Port exist" sys.exit(-1) if not path.exists(cnf): c = _genDict(name, port) mc = MySQLDConfig(cnf, **c) mc.save() else: mc = MySQLDConfig(cnf) if not path.exists(datadir): mysql_install_db(cnf) setOwner(datadir, mc.mysqld_vars["user"])
def createInstance(name, port, dbtype="master", **kw): cnf = path.join(MYSQL_CONF_DIR, "%s.cnf" % name) datadir = path.join(MYSQL_DATA_DIR, name) exists_cnfs = readConfs() if checkPort(exists_cnfs, port): print >> sys.stderr, "Port exist" sys.exit(-1) if not path.exists(cnf): c = _genDict(name, port) c.update(kw) mc = MySQLDConfig(cnf, **c) mc.save() else: mc = MySQLDConfig(cnf) if not path.exists(datadir): mysql_install_db(cnf) setOwner(datadir, mc.mysqld_vars['user']) run_mysql(cnf) cur = connMySQLd(mc) setReplMaster(cur)
def setVariable(name, variable, value): cnf = getCNF(name) if os.path.exists(cnf): mc = MySQLDConfig(cnf) mc.set_var(variable, value) mc.save()