Server-Side Swift with Vapor, Episode 6: Conclusion | Kodeco

This content was released on Feb 13 2018. The official support period is 6-months from this date.

Review what you have learned in this section and see what will be coming up in the next section of this video course.


This is a companion discussion topic for the original entry at https://www.kodeco.com/4493-server-side-swift-with-vapor/lessons/6

I am posting this here as I do not see another forum section for Episode 6. I am trying to adapt the book code to work with the newer swift/async coding… specifically with the mysql example…

I am getting a “Thread 1: Fatal error: Error raised at top level: MySQL error: Unsupported auth plugin name: sha256_password” after it runs…

The changes I made are in Configure.swift:

import NIOSSL
import Fluent
import FluentMySQLDriver
import Vapor

// configures your application
public func configure(_ app: Application) async throws {
    // uncomment to serve files from /Public folder
    // app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))

  var tls = TLSConfiguration.makeClientConfiguration()
  tls.certificateVerification = .none
  
  app.databases.use(.mysql(hostname: "localhost", username: "vapor", password: "vapor", database: "vapor", tlsConfiguration: tls), as: .mysql)
  //try app.databases.use(.mysql(url: "<connection string>"), as: .mysql)
  
  
    app.migrations.add(CreateAcronym())
    
    app.logger.logLevel = .debug
    
    try app.autoMigrate().wait()
    
    // register routes
    try routes(app)
}

Not sure what I am missing here…

Appreciate any help

How are you running the MySQL DB?

Yes sir per the book :