Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection refused (errno: 61) when trying to connect to a remote Database #220

Closed
VanegasDev opened this issue Aug 23, 2023 · 2 comments
Closed

Comments

@VanegasDev
Copy link

I am trying to connect to a remote Database, and I am getting this error
{"error":true,"reason":"connection reset (error set): Connection refused (errno: 61)"}

This is my configuration

    app.databases.use(.mysql(
        hostname: Environment.get("IP") ?? "localhost",
        port: Environment.get("PORT").flatMap(Int.init(_:)) ?? MySQLConfiguration.ianaPortNumber,
        username: Environment.get("USERNAME") ?? "vapor_username",
        password: Environment.get("PASS") ?? "vapor_password",
        database: Environment.get("DB") ?? "vapor_database",
        tlsConfiguration: nil
    ), as: .mysql)

I've already tried this credentials using MySQL Workbench and the connection is taking place correctly, but when I run my Vapor App it returns me the error from above

@0xTim
Copy link
Member

0xTim commented Aug 23, 2023

Few questions:

  • how are you running the Vapor app?
  • is it the same machine as MySQL workbench (and not via docker etc)
  • have you verified the environment variables are being set correctly?

@VanegasDev
Copy link
Author

Thank you so much, the password environment variable wasn't set correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants