Merge pull request #327 from gomfucius/patch-1

Add required parameters for MySQLDatabaseConfig
This commit is contained in:
Tim 2018-05-17 11:20:47 +01:00 committed by GitHub
commit ab329ec1ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,7 @@ You can of course override this config struct if you have non-standard credentia
```swift
/// Register custom MySQL Config
let mysqlConfig = MySQLDatabaseConfig(hostname: "localhost", port: 3306, username: "vapor")
let mysqlConfig = MySQLDatabaseConfig(hostname: "localhost", port: 3306, username: "vapor", password: "mypassword", database: "mydatabase")
services.register(mysqlConfig)
```
@ -166,4 +166,4 @@ router.get("mysql-version") { req -> Future<String> in
In the above example, `withPooledConnection(to:)` is used to create a connection to the database identified by `.mysql`. This is the default database identifier. See [Fluent &rarr; Database](../fluent/database.md#identifier) to learn more.
Once we have the `MySQLConnection`, we can perform a query on it. You can learn more about the methods available in [MySQL &rarr; Core](core.md).
Once we have the `MySQLConnection`, we can perform a query on it. You can learn more about the methods available in [MySQL &rarr; Core](core.md).