loopback-mysql-connector 2.2.1 > 2.3.0 connection failing

327 views
Skip to first unread message

Buck Bito

unread,
Aug 1, 2016, 6:05:25 PM8/1/16
to LoopbackJS
On a Windows 7 laptop running mysql 5.7 and node 5.7.0 I have older working apps connecting to the localhost mysql. I made a clean install of loopback today and it is now loop...@2.29.1 when I start a new 2.x project. When I install loopback-connector-mysql I get loopback-con...@2.3.0. With this setup I cannot connect to the local mysql any longer, receiving the following error:
  • Message: ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)
  • Request: /workspace/api/DataSourceDefinitions/server.mft_date_time_tests/testConnection
  • status: 500

I get this using the same credentials that still work with projects using loop...@2.27.0 and loopback-con...@2.2.1. I have tried both manually modifying the datasources.json and using slc arc with the same result. It seems that when using loop...@2.29.1 / loopback-con...@2.3.0 the user and password are not being passed to the connection. If I roll loopback-connector-mysql back to 2.2.1 it does connect with the new loop...@2.29.1. Does anyone have an idea of what might be going on here?

Raymond Feng

unread,
Aug 1, 2016, 6:25:55 PM8/1/16
to loopb...@googlegroups.com
Does your MySQL require a password? 

Try to use ‘set DEBUG=loopback:connector:mysql’ env var to dump out the settings.


--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/8a99c229-121e-4f82-9433-2ca336a79d2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Buck Bito

unread,
Aug 1, 2016, 7:18:40 PM8/1/16
to loopb...@googlegroups.com
Thanks for the quick reply. I get the following (which is the same console output I get without the DEBUG string):
$ DEBUG=loopback:connector:mysql node .
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
Connection fails:  { [Error: ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)]
  code: 'ER_ACCESS_DENIED_ERROR',
  errno: 1045,
  sqlState: '28000',
  fatal: true }
It will be retried for the next request.
C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\Parser.js:78
        throw err; // Rethrow non-MySQL errors
        ^

Error: ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)
    at Handshake.Sequence._packetToError (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\sequences\Sequence.js:51:14)
    at Handshake.ErrorPacket (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\sequences\Handshake.js:103:18)
    at Protocol._parsePacket (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\Protocol.js:280:23)
    at Parser.write (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\Parser.js:74:12)
    at Protocol.write (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\Protocol.js:39:16)
    at Socket.<anonymous> (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\Connection.js:109:28)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    --------------------
    at Protocol._enqueue (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\Protocol.js:141:48)
    at Protocol.handshake (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\protocol\Protocol.js:52:41)
    at PoolConnection.connect (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\Connection.js:136:18)
    at Pool.getConnection (C:\src\lb\mft-fresh-admin-mysql\node_modules\mysql\lib\Pool.js:48:16)
    at MySQL.connect (C:\src\lb\mft-fresh-admin-mysql\node_modules\loopback-connector-mysql\lib\mysql.js:86:17)
    at Object.initializeDataSource [as initialize] (C:\src\lb\mft-fresh-admin-mysql\node_modules\loopback-connector-mysql\lib\mysql.js:40:28)
    at DataSource.setup (C:\src\lb\mft-fresh-admin-mysql\node_modules\loopback-datasource-juggler\lib\datasource.js:337:19)
    at new DataSource (C:\src\lb\mft-fresh-admin-mysql\node_modules\loopback-datasource-juggler\lib\datasource.js:114:8)
    at Registry.createDataSource (C:\src\lb\mft-fresh-admin-mysql\node_modules\loopback\lib\registry.js:354:12)
    at dataSourcesFromConfig (C:\src\lb\mft-fresh-admin-mysql\node_modules\loopback\lib\application.js:435:19)

I do have user and password in datasources.json and the same file works fine with loopback-con...@2.2.1

-Thanks for any help.

Buck Bito

unread,
Aug 1, 2016, 8:50:08 PM8/1/16
to loopb...@googlegroups.com
SOLVED: The problem was that while working with loopback-con...@2.2.1 I was specifying URL as 'localhost' - This caused no issues with that version of the connector, but with https://github.com/strongloop/loopback-connector-mysql/commit/12cf967b7b7aaf53998e6b5296a1287f64690d91 , any value for URL seems to cause all other connection settings to be ignored. I removed URL from datasources.json and the app now starts and connects.
-Thanks for your help.


On Monday, August 1, 2016 at 3:25:55 PM UTC-7, Raymond Feng wrote:
Reply all
Reply to author
Forward
0 new messages