Sails version: 1.0.0-37
Node version: 8.6.0
NPM version: 5+
DB adapter name: sails-mysql
DB adapter version: 1.0.0-15
Operating system: macOS High Sierra
sails lift --verbose but as it tries to establish a connection to the local database I get an error message saying:
verbose: sockets hook loaded successfully. (22ms)
verbose: Loading adapter (sails-mysql) from this app's node_modules/ directory...
info: ·• Auto-migrating... (alter)
info: Hold tight, this could take a moment.
When attempting to perform the alter auto-migration strategy on model archive, Sails encountered an unexpected error when performing the drop step. This could have happened for a number of different reasons: be it because your database went offline, because of a db permission issue, because of some database-specific edge case, or (more rarely) it could even be due to some kind of bug in this adapter.
Error details:
``
Error:dropcalled itsbadConnection` exit with:
{ error:
{ Error: getaddrinfo ENOTFOUND root root:3306
I'm also using the database connection url (url: 'mysql://root:
@akramin55 Thanks for posting, we'll take a look as soon as possible.
For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.
I don't know why it try check address root root:3306
127.0.0.1 to localhostmysql -h 127.0.0.1 -u root -p Self@bato3 I tried changing the host from 127.0.0.1 to localhost and it didn't change anything. I tested the connection on Sequel Pro for Mac successfully and also ran mysql -h 127.0.0.1 -u root -p Self and put in my password and was able to log in.
@akraminakib hmm would you share your exact connection URL? (e.g. replace the password with some other word, like "lemonade" or something) I get the impression there might be a subtle typo.
Also, just to make sure, would you run npm ls sails-mysql and post the output?
@mikermcneil my connection URL is mysql://root:[email protected]:3306/Self (I've also changed the host ip to localhost and checked, in case that changes anything).
Also, running npm ls sails-mysql outputs:
Akramins-MacBook-Pro:self akraminakib$ npm ls sails-mysql
[email protected] /Users/akraminakib/Desktop/self
└── [email protected]
Here's exactly what it outputs when I run sails lift --verbose:
info: Starting app...
verbose: • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
verbose: • Loading Sails with "verbose" logging enabled... •
verbose: • (For even more details, try "silly".) •
verbose: • •
verbose: • http://sailsjs.com/config/log •
verbose: • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
verbose: moduleloader hook loaded successfully. (0ms)
verbose: userconfig hook loaded successfully. (11ms)
verbose: Exposing global variables... (you can customize/disable this by modifying the properties in sails.config.globals. Set it to false to disable all globals.)
verbose: userhooks hook loaded successfully. (339ms)
verbose: logger hook loaded successfully. (14ms)
verbose: request hook loaded successfully. (0ms)
verbose: views hook loaded successfully. (0ms)
verbose: responses hook loaded successfully. (2ms)
verbose: helpers hook loaded successfully. (1ms)
verbose: policies hook loaded successfully. (1ms)
verbose: services hook loaded successfully. (0ms)
verbose: security hook loaded successfully. (2ms)
verbose: i18n hook loaded successfully. (4ms)
verbose: session hook loaded successfully. (25ms)
verbose: http hook loaded successfully. (127ms)
verbose: sockets hook loaded successfully. (17ms)
verbose: Loading adapter (sails-mysql) from this app's node_modules/ directory...
info: ·• Auto-migrating... (alter)
info: Hold tight, this could take a moment.
When attempting to perform the alter auto-migration strategy on model user, Sails encountered an unexpected error when performing the drop step. This could have happened for a number of different reasons: be it because your database went offline, because of a db permission issue, because of some database-specific edge case, or (more rarely) it could even be due to some kind of bug in this adapter.
Error details:
Error: `drop` called its `badConnection` exit with:
{ error:
{ Error: Handshake inactivity timeout
at Handshake.<anonymous> (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:160:17)
at emitNone (events.js:105:13)
at Handshake.emit (events.js:207:7)
at Handshake._onTimeout (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/sequences/Sequence.js:116:8)
at ontimeout (timers.js:471:11)
at tryOnTimeout (timers.js:306:5)
at Timer.listOnTimeout (timers.js:266:5)
--------------------
at Protocol._enqueue (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:141:48)
at Protocol.handshake (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:52:41)
at PoolConnection.connect (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/Connection.js:123:18)
at Pool.getConnection (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/Pool.js:45:23)
at Object.getConnection (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/machines/get-connection.js:78:25)
at afterwards (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:849:24)
at _doCacheLookupMaybe (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:426:27)
at helpExecMachineInstance (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:467:5)
at Machine.exec (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/Machine.prototype.exec.js:105:3)
at spawnConnection (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/private/connection/spawn-connection.js:29:4)
at Object.spawnOrLeaseConnection (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/private/connection/spawn-or-lease-connection.js:23:3)
at Object.drop (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/drop.js:71:24)
at afterwards (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:849:24)
at _doCacheLookupMaybe (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:426:27)
at helpExecMachineInstance (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:467:5)
at Machine.exec (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/Machine.prototype.exec.js:105:3)
at Object.drop (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/lib/adapter.js:434:10)
at findCallback (/Users/akraminakib/Desktop/self/node_modules/waterline-utils/lib/auto-migrations/private/run-alter-strategy/index.js:122:17)
at _tryToRunCb (/Users/akraminakib/Desktop/self/node_modules/waterline/node_modules/parley/lib/private/Deferred.js:233:18)
at /Users/akraminakib/Desktop/self/node_modules/waterline/node_modules/parley/lib/private/Deferred.js:443:16
at _afterFetchingRecords (/Users/akraminakib/Desktop/self/node_modules/waterline/lib/waterline/methods/find.js:260:20)
at _afterGettingPopulatedPhysicalRecords (/Users/akraminakib/Desktop/self/node_modules/waterline/lib/waterline/utils/query/help-find.js:584:23)
code: 'PROTOCOL_SEQUENCE_TIMEOUT',
fatal: true,
timeout: 10000 },
meta:
{ host: 'localhost',
port: 3306,
schema: true,
adapter: 'sails-mysql',
url: 'mysql://root:[email protected]:3306/Self',
identity: 'default' } }
at afterMaybeArtificiallyWaiting (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:369:21)
at maybeArtificiallyWait (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:220:20)
at afterPotentiallyCaching (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:240:11)
at _cacheIfAppropriate (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:98:18)
at Function._interceptExit [as badConnection] (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:111:9)
at spawnConnectionCb (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/drop.js:73:22)
at Object.failedToConnect (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/private/connection/spawn-connection.js:34:14)
at afterMaybeArtificiallyWaiting (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:406:21)
at maybeArtificiallyWait (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:220:20)
at afterPotentiallyCaching (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:240:11)
at _cacheIfAppropriate (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:98:18)
at Function._interceptExit [as failed] (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:111:9)
at _gotConnection (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/machines/get-connection.js:80:22)
at Handshake.onConnect [as _callback] (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/Pool.js:54:9)
at Handshake.Sequence.end (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at /Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:399:18
at Array.forEach (<anonymous>)
at /Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:398:13
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
Some development data was recovered (see .tmp/automigration.user.1633.log). Any existing user records were deleted, but your data from OTHER models (including any relationships tracked in foreign keys and join tables) might still be intact. If you care about recovering any of that data, be sure to back it up now before you continue.
The best way to proceed from here is to clear out all of your old development data and start fresh; allowing Sails to generate new tables/collections(s) to reflect your app's models. (In other words, to DELETE ALL EXISTING DATA stored in models.)
To do that, re-lift your app using the drop strategy:
sails lift --drop
After doing that once, you should be able to go about your business as usual.
For more about auto-migrations, visit:
https://sailsjs.com/docs/concepts/models-and-orm/model-settings#?migrate
When attempting to perform the alter auto-migration strategy on model archive, Sails encountered an unexpected error when performing the drop step. This could have happened for a number of different reasons: be it because your database went offline, because of a db permission issue, because of some database-specific edge case, or (more rarely) it could even be due to some kind of bug in this adapter.
Error details:
Error: `drop` called its `badConnection` exit with:
{ error:
{ Error: Handshake inactivity timeout
at Handshake.<anonymous> (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:160:17)
at emitNone (events.js:105:13)
at Handshake.emit (events.js:207:7)
at Handshake._onTimeout (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/sequences/Sequence.js:116:8)
at ontimeout (timers.js:471:11)
at tryOnTimeout (timers.js:306:5)
at Timer.listOnTimeout (timers.js:266:5)
--------------------
at Protocol._enqueue (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:141:48)
at Protocol.handshake (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:52:41)
at PoolConnection.connect (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/Connection.js:123:18)
at Pool.getConnection (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/Pool.js:45:23)
at Object.getConnection (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/machines/get-connection.js:78:25)
at afterwards (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:849:24)
at _doCacheLookupMaybe (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:426:27)
at helpExecMachineInstance (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:467:5)
at Machine.exec (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/Machine.prototype.exec.js:105:3)
at spawnConnection (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/private/connection/spawn-connection.js:29:4)
at Object.spawnOrLeaseConnection (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/private/connection/spawn-or-lease-connection.js:23:3)
at Object.drop (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/drop.js:71:24)
at afterwards (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:849:24)
at _doCacheLookupMaybe (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:426:27)
at helpExecMachineInstance (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/help-exec-machine-instance.js:467:5)
at Machine.exec (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/Machine.prototype.exec.js:105:3)
at Object.drop (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/lib/adapter.js:434:10)
at findCallback (/Users/akraminakib/Desktop/self/node_modules/waterline-utils/lib/auto-migrations/private/run-alter-strategy/index.js:122:17)
at _tryToRunCb (/Users/akraminakib/Desktop/self/node_modules/waterline/node_modules/parley/lib/private/Deferred.js:233:18)
at /Users/akraminakib/Desktop/self/node_modules/waterline/node_modules/parley/lib/private/Deferred.js:443:16
at _afterFetchingRecords (/Users/akraminakib/Desktop/self/node_modules/waterline/lib/waterline/methods/find.js:260:20)
at _afterGettingPopulatedPhysicalRecords (/Users/akraminakib/Desktop/self/node_modules/waterline/lib/waterline/utils/query/help-find.js:584:23)
code: 'PROTOCOL_SEQUENCE_TIMEOUT',
fatal: true,
timeout: 10000 },
meta:
{ host: 'localhost',
port: 3306,
schema: true,
adapter: 'sails-mysql',
url: 'mysql://root:[email protected]:3306/Self',
identity: 'default' } }
at afterMaybeArtificiallyWaiting (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:369:21)
at maybeArtificiallyWait (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:220:20)
at afterPotentiallyCaching (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:240:11)
at _cacheIfAppropriate (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:98:18)
at Function._interceptExit [as badConnection] (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:111:9)
at spawnConnectionCb (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/drop.js:73:22)
at Object.failedToConnect (/Users/akraminakib/Desktop/self/node_modules/sails-mysql/helpers/private/connection/spawn-connection.js:34:14)
at afterMaybeArtificiallyWaiting (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:406:21)
at maybeArtificiallyWait (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:220:20)
at afterPotentiallyCaching (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:240:11)
at _cacheIfAppropriate (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:98:18)
at Function._interceptExit [as failed] (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/node_modules/machine/lib/private/intercept-exit-callbacks.js:111:9)
at _gotConnection (/Users/akraminakib/Desktop/self/node_modules/machinepack-mysql/machines/get-connection.js:80:22)
at Handshake.onConnect [as _callback] (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/Pool.js:54:9)
at Handshake.Sequence.end (/Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at /Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:399:18
at Array.forEach (<anonymous>)
at /Users/akraminakib/Desktop/self/node_modules/mysql/lib/protocol/Protocol.js:398:13
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
Some development data was recovered (see .tmp/automigration.archive.1633.log). Any existing archive records were deleted, but your data from OTHER models (including any relationships tracked in foreign keys and join tables) might still be intact. If you care about recovering any of that data, be sure to back it up now before you continue.
The best way to proceed from here is to clear out all of your old development data and start fresh; allowing Sails to generate new tables/collections(s) to reflect your app's models. (In other words, to DELETE ALL EXISTING DATA stored in models.)
To do that, re-lift your app using the drop strategy:
sails lift --drop
After doing that once, you should be able to go about your business as usual.
For more about auto-migrations, visit:
https://sailsjs.com/docs/concepts/models-and-orm/model-settings#?migrate
error: A hook (orm) failed to load!
verbose: Lowering sails...
error: Error: Automigrations failed. (See logs above for help, and a summary of what went wrong.)
at Timeout._onTimeout (/Users/akraminakib/Desktop/self/node_modules/waterline-utils/lib/auto-migrations/private/run-alter-strategy/private/inform-re-failed-alter-stratagem.js:192:55)
at ontimeout (timers.js:471:11)
at tryOnTimeout (timers.js:306:5)
at Timer.listOnTimeout (timers.js:266:5)
@akraminakib Sorry to keep making you go back to the console, but just to be double triple sure--is MySQL definitely running on port 3306? I didn't see a port option in the CLI command you tried. So try:
mysql -h 127.0.0.1 -u root -p Self -P 3306
and make sure that works. The error message you posted is exactly what I'd expect if you were trying to connect to the wrong port with Sails.
@sgress454 Running mysql -h 127.0.0.1 -u root -p Self -P 3306 prompts me to input my password and after I put it I can execute SQL commands like show databases; in which it gives back the list of databases including Self.
@akraminakib Well, I'm stumped :(. I gave you the command slightly scrambled (should be mysql -h 127.0.0.1 -u root -p -P 3306 Self) but if you were able to log in using the same password you're supplying in your Sails config, and switch to the Self database and issue SQL commands, that should indicate that everything is working. The error message you're getting strongly suggests that Sails is not able to connect because either the _host_ or the _port_ you're supplying in the URL is incorrect. If it were a problem with the username, password or database you'd get a different error.
@sgress454 hmmm that's strange. I'm able to run mysql -h 127.0.0.1 -u root -p -P 3306 Self and then switch databases to Self and show tables.
@akraminakib any change this could be related to case-sensitivity of the database name?
@mikermcneil I've tried both with self and Self and I get the same error message. I've resorted to using sails 0.12.14 with sails-mysql 0.11.5 and using the individual fields like below, which seems to work fine.
someMysqlServer: {
adapter: 'sails-mysql',
host: 'localhost',
port: 3306,
user: 'root',
password: 'lemonade',
database: 'Self'
},
I had exactly the same issue. In my case the problem was the password.
The password was -> AjJU4ppJbJXmpCAt]j%<@HUR7
When i changed it finally works.
@akraminakib,@sailsbot,@bato3,@mikermcneil,@sgress454,@hiroxe: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
It was the password characters in my case too. I had a # symbol and that made it fail. Using "sails-mysql": "^1.0.0-16" with sails@beta. Replaced # with something else in my local password and it works now!
Had the same problem here. It was because of my password, I had a # symbol too.
BTW, I use sails-mysql adapter, but I had a similar issue with sails-mongo where providing a urlconnection with my password (and a # symbol) didn't work, but splitting parameters host, port, user etc... separately worked.
Would be awesome if this bug is fixed, it is very common to use a password with special characters. #4352
Hi all,
I also encountered this problem with one of our passwords has the # symbol, a temporary solution is to url encode it and it would work just fine. It believe it would work on every special characters.
Hope this helps.
I confirm. The # symbol in my password caused the error. It's not yet solved in sails 1.1.0
use urlencode on password
@akraminakib @bato3 @sgress454 @hiroxe @alaouizoubair @AngeloAballe @maido155 @Tinostarn @shekhardesigner - Hey, just wanted to let everyone know we have a new sails-sql adapter in development that includes support for exclamation marks in the password. I've verified the current sails-sql connects to MSSQL databases with exclamation marks in the password (which also include CAPS, lowercase, and numbers).
It was the password characters in my case too. I had a
#symbol and that made it fail. Using"sails-mysql": "^1.0.0-16"with sails@beta. Replaced#with something else in my local password and it works now!
You saved the day!
If someone happens to land on this and it isn't their password causing issues (I have root:root locally, and I'm on M1 Macbook with Mysql 8 via homebrew), the fix for me ended up being ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; flush privileges;. I was getting a ER_NOT_SUPPORTED_AUTH_MODE error, but otherwise similar error dump as the original post.
Most helpful comment
Had the same problem here. It was because of my password, I had a
#symbol too.BTW, I use
sails-mysqladapter, but I had a similar issue withsails-mongowhere providing aurlconnectionwith my password (and a#symbol) didn't work, but splitting parametershost,port,useretc... separately worked.