def grant_privileges(self): self.get_mysql_root_password() database._mysql_exec_as_root( "GRANT ALL PRIVILEGES ON %s.* TO '%s'@'localhost'" % (self.TEST_DB, self.TEST_USER)) database._mysql_exec_as_root("FLUSH PRIVILEGES")
def create_database(self): self.get_mysql_root_password() self.drop_database() database._mysql_exec_as_root("CREATE DATABASE %s CHARACTER SET utf8" % self.TEST_DB)
def create_table(self): self.get_mysql_root_password() database._mysql_exec_as_root("CREATE TABLE %s.%s(mycolumn CHAR(30))" % (self.TEST_DB, self.TEST_TABLE))
def create_database_user(self): self.get_mysql_root_password() self.drop_database_user() database._mysql_exec_as_root( "CREATE USER '%s'@'localhost' IDENTIFIED BY '%s'" % (self.TEST_USER, self.TEST_PASSWORD))
def drop_database(self): self.get_mysql_root_password() if database._db_exists(self.TEST_DB): database._mysql_exec_as_root("DROP DATABASE %s" % self.TEST_DB)
def drop_database_user(self): self.get_mysql_root_password() if database._test_mysql_user_exists(self.TEST_USER): database._mysql_exec_as_root("DROP USER '%s'@'localhost'" % self.TEST_USER)