I want to connect a MySQL database on my machine with a Vapor 3 app.
My current configure.swift
file looks as follows:
try services.register(FluentMySQLProvider())
...
let mysqlConfig = MySQLDatabaseConfig(
username: "dev",
password: "",
database: "test"
)
let mysql = MySQLDatabase(config: mysqlConfig)
var databases = DatabasesConfig()
databases.add(database: mysql, as: .mysql)
services.register(databases)
This works just fine. However, since I need to add my Model to the migration configuration, I also need to add:
var migrations = MigrationConfig()
migrations.add(model: Posts.self, database: .mysql)
services.register(migrations)
When running the app this time, I'm seeing an error saying:
Full authentication not supported over insecure connections.
After some research, it seems that this error can be overcome by changing the password logic from caching_sha2_password
to mysql_native_password
.
However, that leaves me with the error saying:
Unrecognized basic packet.
How do I fix this?