Killall before dropping mysql databases/users.

This commit is contained in:
Michael Hierweck 2014-08-28 19:53:21 +02:00
parent c031f5004c
commit 90350b0ca0
2 changed files with 2 additions and 0 deletions

View File

@ -56,6 +56,7 @@ public class MySqlDatabaseProcessorFactory implements EntityProcessorFactory {
String aName = AbstractEntity.escapeString(db.getName()); String aName = AbstractEntity.escapeString(db.getName());
String aOwner = AbstractEntity.escapeString(db.getOwner()); String aOwner = AbstractEntity.escapeString(db.getOwner());
aJDBCP.addSQL("REVOKE ALL ON " + aName + ".* FROM '" + aOwner + "'@'%'"); aJDBCP.addSQL("REVOKE ALL ON " + aName + ".* FROM '" + aOwner + "'@'%'");
aJDBCP.addSQL("CALL mysql.kill_by_database('" + aName + "');");
aJDBCP.addSQL("DROP DATABASE IF EXISTS " + aName); aJDBCP.addSQL("DROP DATABASE IF EXISTS " + aName);
return aJDBCP; return aJDBCP;
} }

View File

@ -41,6 +41,7 @@ public class MySqlUserProcessorFactory implements EntityProcessorFactory {
JDBCProcessor aJDBCP = MySqlDatabaseProcessorFactory.createMySqlAdminProcessor(); JDBCProcessor aJDBCP = MySqlDatabaseProcessorFactory.createMySqlAdminProcessor();
String aName = AbstractEntity.escapeString(dbu.getName()); String aName = AbstractEntity.escapeString(dbu.getName());
aJDBCP.addSQL("REVOKE ALL PRIVILEGES, GRANT OPTION FROM '" + aName + "'@'%'"); aJDBCP.addSQL("REVOKE ALL PRIVILEGES, GRANT OPTION FROM '" + aName + "'@'%'");
aJDBCP.addSQL("CALL mysql.kill_by_user('" + aName + "');");
aJDBCP.addSQL("DROP USER '" + aName + "'@'%'"); aJDBCP.addSQL("DROP USER '" + aName + "'@'%'");
return aJDBCP; return aJDBCP;
} }