Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

416
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda