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 Using Unix Sockets getting Error : getaddrinfo ENOENT #6547
Comments
We currently don't support a socketPath config option. I'm not against it, just hasn't come up yet. For the time being you can just set I'll mark this as a feature request. I don't know when I will get a chance to look at it but if anyone wants to do a PR it'd be welcome! |
Hey there, Thanks for the quick response. The problem is that the db that i'm using is not allowing network connections and only be usable by socket. That's why i can't connect to it . Isn't sails-mysql using node-mysql in the background. As i remember it's available in the node-mysql settings. |
I just added it to the marshalConfig function 16ecaf3e99e73728294650edb2ac76f02e163b76 so it should get passed down to node-mysql. Let me know if that works and if so I can do an npm push. |
Seems like not working. Is there something that i can do ? |
I just tried and was able to connect over a socket. What's the error you get when it fails? Also you tried using a clone of the repo correct? |
Actually i haven't clone the whole repo just added the diff code. The error i'm getting is this. Error spawning mySQL connection: domain.js:66 |
hmm as long as that socketPath value is getting into either of these places it's just using node-mysql to create a connection: with pooling: https://github.com/balderdashy/sails-mysql/blob/master/lib/adapter.js#L66 Also I just want to make sure your adapter config is correct. If you are using it from module.exports.adapters = {
'default': 'mysql',
mysql: {
module: 'sails-mysql',
user: 'username',
password: 'password',
database: 'databaseName',
socketPath: '/tmp/mysql.sock'
}
} And if you are defining the connection directly on a model it will look like: module.exports = {
adapter: 'mysql',
config: {
user: 'username',
password: 'password',
database: 'databaseName',
socketPath: '/tmp/mysql.sock'
},
attributes: {
}
} |
Cheers mate ! I was trying to use the adapter without defining a config object thus leading to that problem. Thanks for the help now it's working perfectly. 👍 |
This is pushed to NPM now at version |
I'm aware that sails-mysql uses node-mysql in the background. But i still can't seem to use the mysql socket to connect. Is there an option for this ?
What i'm trying to do is
I can use this socket via other apps (e.g a Rails app, a custom Node app ) and can also telnet localhost 3306.
Any suggestions?
The text was updated successfully, but these errors were encountered: