Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

406
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!