示例#1
0
文件: myman.py 项目: xoyabc/python
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()
示例#2
0
文件: myman.py 项目: 467754239/python
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()
示例#3
0
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"])
示例#4
0
文件: myman.py 项目: xoyabc/python
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)
示例#5
0
文件: myman.py 项目: 467754239/python
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)
示例#6
0
def setVariable(name, variable, value):
    cnf = getCNF(name)
    if os.path.exists(cnf):
        mc = MySQLDConfig(cnf)
        mc.set_var(variable, value)
        mc.save()