@@ -125,6 +125,7 @@ ConnectionFactoryOptions options = ConnectionFactoryOptions.builder()
125125 .option(PORT , 3306 ) // optional, default 3306
126126 .option(PASSWORD , " database-password-in-here" ) // optional, default null, null means has no password
127127 .option(DATABASE , " r2dbc" ) // optional, default null, null means not specifying the database
128+ .option(Option . valueOf(" createDatabaseIfNotExist" ), true ) // optional, default false, create database if not exist (since 1.0.6 / 0.9.7)
128129 .option(CONNECT_TIMEOUT , Duration . ofSeconds(3 )) // optional, default null, null means no timeout
129130 .option(Option . valueOf(" socketTimeout" ), Duration . ofSeconds(4 )) // deprecated since 1.0.1, because it has no effect and serves no purpose.
130131 .option(SSL , true ) // optional, default sslMode is "preferred", it will be ignore if sslMode is set
@@ -172,6 +173,7 @@ MySqlConnectionConfiguration configuration = MySqlConnectionConfiguration.builde
172173 .port(3306 ) // optional, default 3306
173174 .password(" database-password-in-here" ) // optional, default null, null means has no password
174175 .database(" r2dbc" ) // optional, default null, null means not specifying the database
176+ .createDatabaseIfNotExist(true ) // optional, default false, create database if not exist (since 1.0.6 / 0.9.7)
175177 .serverZoneId(ZoneId . of(" Continent/City" )) // optional, default null, null means query server time zone when connection init
176178 .connectTimeout(Duration . ofSeconds(3 )) // optional, default null, null means no timeout
177179 .socketTimeout(Duration . ofSeconds(4 )) // deprecated since 1.0.1, because it has no effect and serves no purpose.
@@ -221,6 +223,7 @@ Mono<Connection> connectionMono = Mono.from(connectionFactory.create());
221223| user | A valid MySQL username and not be empty | Required | Who wants to connect to the MySQL database |
222224| password | Any printable string | Optional, default no password | The password of the MySQL database user |
223225| database | A valid MySQL database name | Optional, default does not initialize database | Database used by the MySQL connection |
226+ | createDatabaseIfNotExist | ` true ` or ` false ` | Optional, default ` false ` | Create database if not exist |
224227| connectTimeout | A ` Duration ` which must be positive duration | Optional, default has no timeout | TCP connect timeout |
225228| socketTimeout | A ` Duration ` which must be positive duration | Deprecated since 1.0.1 | TCP socket timeout |
226229| serverZoneId | An id of ` ZoneId ` | Optional, default query time zone when connection init | Server time zone id |
0 commit comments