sails: Can't establish connection to local MySQL in Sails 1.0.0-37

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


I'm trying to start the sails development server connected to a MySQL started on my macbook using `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: `drop` called its `badConnection` exit with:
{ error:
   { Error: getaddrinfo ENOTFOUND root root:3306

I'm also using the database connection url (url: 'mysql://root:<password>@127.0.0.1:3306/Self') in the datastore.js as per the documentation instead of their individual fields.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

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.

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.

I confirm. The # symbol in my password caused the error. It’s not yet solved in sails 1.1.0

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!