Skip to content

Commit

Permalink
Merge pull request #3 from PaaS-TA/use-pxc
Browse files Browse the repository at this point in the history
[OPENPAAS-SERVICE-JAVA-BROKER-MYSQL] pxc(mysql) support
  • Loading branch information
okpc579 committed Sep 2, 2022
2 parents 7dd4a81 + 4afceeb commit 8525b3c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ dependencies {
exclude group: 'net.java.dev.jna'
}
compile "org.springframework:spring-jdbc:4.0.0.M3"
compile 'mysql:mysql-connector-java:8.0.28'

}

Expand All @@ -93,4 +94,4 @@ test {
jacoco {
destinationFile = file("$buildDir/jacoco/jacoco-overall.exec")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,16 @@ public void createUser(String database, String userId, String password) throws M

System.out.println("======== cce_enable : "+env.getRequiredProperty("cce_enable"));
if("true".equals(env.getRequiredProperty("cce_enable").toLowerCase())){
//CCE 조치 - ed25519 암호화 방식 적용
jdbcTemplate.execute("UPDATE mysql.user SET password = '', plugin = 'ed25519', authentication_string = ed25519_password('"+password+"') where user = '"+userId+"' and host = '%'");
jdbcTemplate.execute("FLUSH PRIVILEGES");

if("mysql".equals(env.getRequiredProperty("database_type").toLowerCase())){
//CCE 조치 - sha256 암호화 방식 적용(mysql)
jdbcTemplate.execute("alter user '"+userId+"'@'%' identified with sha256_password by '"+password +"'");
jdbcTemplate.execute("FLUSH PRIVILEGES");
}else if("mariadb".equals(env.getRequiredProperty("database_type").toLowerCase())){
//CCE 조치 - ed25519 암호화 방식 적용(mariadb)
jdbcTemplate.execute("UPDATE mysql.user SET password = '', plugin = 'ed25519', authentication_string = ed25519_password('"+password+"') where user = '"+userId+"' and host = '%'");
jdbcTemplate.execute("FLUSH PRIVILEGES");
}
}

//GRANT ALL ON cf_11b9e707_0e2b_47e3_a21a_fd01a8eb0454.* TO '62519bdc9523157e'@'%' WITH MAX_USER_CONNECTIONS 2;
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/datasource.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ jdbc.pwd = your-db-pwd
jdbc.url = jdbc:mysql://your-db-url:your-db-port
jdbc.host = your-db-host
jdbc.port = your-db-port
cce_enable = false
cce_enable = false
database_type = mysql

0 comments on commit 8525b3c

Please sign in to comment.