Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

409
Vistas
MySQL & Vapor 3: unrecognized basic packet, full auth not supported

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?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

From MySQL 8 if you want to use it on localhost (unsecured connection) then you need to disable the MySQL transport layer security. Use unverifiedTLS for transport in MySQLDatabaseConfig initializer.

Your MySQLDatabaseConfig initializer should look something like this:

let config = MySQLDatabaseConfig(
    hostname: "127.0.0.1",
    port: 3306,
    username: "dev",
    password: "",
    database: "test",
    transport: MySQLTransportConfig.unverifiedTLS
)

It should work fine with this configuration.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda