mcMMO now supports SSL and tries to use it by default for MySQL (turn this off in config.yml MySQL.Server.SSL)

this fixes a lot of console spam from default mysql installs
This commit is contained in:
nossr50
2019-01-12 17:26:17 -08:00
parent 1f2e6cd5f5
commit 4cfb7a5f4b
4 changed files with 11 additions and 1 deletions

View File

@ -346,6 +346,7 @@ public class Config extends AutoUpdateConfigLoader {
public String getMySQLUserPassword() { return getStringIncludingInts("MySQL.Database.User_Password"); }
public int getMySQLMaxConnections(PoolIdentifier identifier) { return config.getInt("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()), 30); }
public int getMySQLMaxPoolSize(PoolIdentifier identifier) { return config.getInt("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()), 10); }
public boolean getMySQLSSL() { return config.getBoolean("MySQL.Server.SSL", true); }
private String getStringIncludingInts(String key) {
String str = config.getString(key);

View File

@ -36,6 +36,13 @@ public final class SQLDatabaseManager implements DatabaseManager {
String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName()
+ ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName();
if(Config.getInstance().getMySQLSSL())
connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName()
+ ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName() +
"?verifyServerCertificate=false"+
"&useSSL=true"+
"&requireSSL=true";
try {
// Force driver to load if not yet loaded
Class.forName("com.mysql.jdbc.Driver");

View File

@ -166,7 +166,7 @@ MySQL:
Load: 20
Save: 20
Server:
SSL: false
SSL: true
Port: 3306
Address: localhost