vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
149 stars 53 forks source link

PostgreSQL connection crash when supplying password #97

Closed UnoDean closed 5 years ago

UnoDean commented 6 years ago

Use "PostgreSQLDatabaseConfig(hostname: "localhost", port: 5432, username: "postgres", database: "postgres", password: "123456")" crash log: PostgreSQL Error: No password is required- id: PostgreSQLError.trust But I found this issue “https://github.com/vapor/fluent-postgresql/issues/22” has been closed

Jinxiansen commented 6 years ago

You don't need to enter a password on macOS, you can refer to my configuration here....

https://github.com/Jinxiansen/SwiftServerSide-Vapor/blob/master/VaporServer/Sources/App/Utility/SQLConfig.swift

#if os(Linux)
        return PostgreSQLDatabaseConfig(hostname: hostname,
                                        port: port,
                                        username: username,
                                        database: database,
                                        password:password)
#else
       return PostgreSQLDatabaseConfig(hostname: hostname,
                                        port: port,
                                        username: username,
                                        database: database)

English is not my native language; please excuse typing errors.

ingramwang2015 commented 6 years ago

You don't need to enter a password on macOS, you can refer to my configuration here....

https://github.com/Jinxiansen/SwiftServerSide-Vapor/blob/master/VaporServer/Sources/App/Utility/SQLConfig.swift

#if os(Linux)
        return PostgreSQLDatabaseConfig(hostname: hostname,
                                        port: port,
                                        username: username,
                                        database: database,
                                        password:password)
#else
       return PostgreSQLDatabaseConfig(hostname: hostname,
                                        port: port,
                                        username: username,
                                        database: database)

English is not my native language; please excuse typing errors.

it's works. Thanks!

Jinxiansen commented 6 years ago

💪💪 You're welcome !

Manish19Kumar commented 5 years ago

I am setting my database configuration as below: let hostname = Environment.get("DATABASE_HOSTNAME") ?? "localhost" let username = Environment.get("DATABASE_USER") ?? "vapor" let databaseName = Environment.get("DATABASE_DB") ?? "vapor" let password = Environment.get("DATABASE_PASSWORD") ?? "password" let databaseConfig = PostgreSQLDatabaseConfig(hostname: hostname, username: username, database: databaseName, password: password ) let database = PostgreSQLDatabase(config: databaseConfig)

but I am getting this error "Fatal error: Error raised at top level: ⚠️ PostgreSQL Error: Password is required" Please provide a solution for this problem