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

sequelize - connection string - problem with password containing an @ #676

Closed
FredericLatour opened this issue Sep 17, 2017 · 5 comments
Closed

Comments

@FredericLatour
Copy link

It looks like it doesn't work when having a password containing a @ directly in the connection string for sequelize:

  • "mysql": "mysql://user:pwd@host:port/database"

I imagine (just a guess) that it has something to do with the @ that is used to separate the password and the host. It certainly mess up the parsing to have another @.

@daffl
Copy link
Member

daffl commented Sep 17, 2017

SQL connection strings with special characters have to be URL encoded:

encodeURIComponent('my@password') // -> 'my%40password'

@FredericLatour
Copy link
Author

FredericLatour commented Sep 18, 2017

Not a show stopper but not very intuitive especially in those days when we are force to include weird chars into passwords.
Is it possible to provide a config object instead of the connection string?

{
user: '',
pwd:'',
host: '',
etc ...
}

@daffl
Copy link
Member

daffl commented Sep 18, 2017

You can always change the connection as shown in the Sequelize documentation in the connection file set up by the generator.

@FredericLatour
Copy link
Author

I suppose I'd better not hacking this file and stick with your solution. It's not like I will have a password to encode every day, after all.
Thanks for the help (will close the issue).

@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants