Sails kann keine Verbindung zu mySql @ herstell
uf einem brandneuen Segelprojekt habe ich hinzugefüg
localMysql: {
adapter: 'sails-mysql',
host: 'localhost',
user: 'homestead',
password: 'secret',
database: 'sails'
},
on config.connections.js und:
connection: 'localMysql',
migrate: 'alter'
on config.models.js. Ein Benutzermodell wird auf api / models / User.js gesetzt:
// api/models/User.js
module.exports = {
attributes: {
appid: {
type: 'string'
},
uid: {
type: 'string'
},
hid: {
type: 'string'
},
params: {
type: 'string'
}
}
}
eim Laufen, Segel heben erhalte ich:
error: A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
: Could not connect to MySQL:
Error: connect ECONNREFUSED
at afterwards (/home/vagrant/sails/track/node_modules/sails-mysql/lib/connections/spawn.js:75:13)
at /home/vagrant/sails/track/node_modules/sails-mysql/lib/connections/spawn.js:40:7
at Pool.<anonymous> (/home/vagrant/sails/track/node_modules/sails-mysql/node_modules/mysql/lib/Pool.js:47:16)
at Handshake.Sequence.end (/home/vagrant/sails/track/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:78:24)
at Protocol.handleNetworkError (/home/vagrant/sails/track/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:282:14)
at PoolConnection.Connection._handleNetworkError (/home/vagrant/sails/track/node_modules/sails-mysql/node_modules/mysql/lib/Connection.js:303:18)
at Socket.emit (events.js:95:17)
at net.js:440:14
at process._tickDomainCallback (node.js:463:13)
Währenddessen kann ich in demselben Ordner, in dem ich sails ausgeführt habe, erfolgreich eine Verbindung zu mysql herstellen (die sails-Datenbank ist derzeit leer), indem ich:
mysql --user=homestead --password=secret --host=localhost --database=sails
Beide Segel und MySQL laufen in einer Landstreicher-Box.
Irgendein Vorschlag