import MySQLdb, subprocess, os, platform

def mysql_Start():
    try:
        path = os.getcwd() + "/mysql/bin"
        cmd = path + "/mysqld.exe"
        popen = subprocess.Popen(cmd, shell=True)
        #popen.wait()
    except:
        pass

def mysql_Stop():
    try:
        path = os.getcwd() + "/mysql/bin"
        cmd = path + "/mysqladmin shutdown -u root"
        popen = subprocess.Popen(cmd, shell=True)
        #popen.wait()
    except:
        pass

def else_Start():
    using_os = platform.system()
    if using_os == "Darwin":
        try:
            cmd = "mysql.server start"
            popen = subprocess.Popen(cmd, shell=True)
        except Exception as e:
            print(e)
    else:
        pass

def else_Stop():
    using_os = platform.system()
    if using_os == "Darwin":
        try:
            cmd = "mysql.server stop"
            popen = subprocess.Popen(cmd, shell=True)
        except:
            pass
    else:
        pass
