Of course there are many options we may wish to set for a MySQL
database. These options may be specified as part of the JDBC
connection string simply by prefixing each server option with
server.
. In the following example we set two
driver parameters and two server parameters:
String url = "jdbc:mysql://" + hostColonPort + "/" + "?" + "cacheServerConfiguration=true" + "&" + "useLocalSessionState=true" + "&" + "server.basedir=/opt/myapp/db" + "&" + "server.datadir=/mnt/bigdisk/myapp/data";
Starting with Connector/MXJ 5.0.6 you can use the
initialize-user
property to a connection
string. If set to true, the default anonymous and root users
will be removed and the user/password combination from the
connection URL will be used to create a new user. For example:
String url = "jdbc:mysql:mxj://localhost:" + port + "/alice_db" + "?server.datadir=" + dataDir.getPath() + "&server.initialize-user=true" + "&createDatabaseIfNotExist=true" ;
User Comments
Add your own comment.