mirror of https://github.com/vapor/docs.git
Merge pull request #327 from gomfucius/patch-1
Add required parameters for MySQLDatabaseConfig
This commit is contained in:
commit
ab329ec1ca
|
|
@ -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 → 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 → 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 → Core](core.md).
|
||||
|
|
|
|||
Loading…
Reference in New Issue