Skip to content
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

Could not connect to DB from Node JS but successfully connect from php and phpmyadmin #250

Closed
ashalaenko opened this issue Jul 17, 2012 · 11 comments

Comments

@ashalaenko
Copy link

Hi. I Got a problem. I have a DB and program code in NodeJS for work with this DB. But I got an error :
Access denied for user 'user'@'127.0.0.1' (using password: YES).

But when I tried to connect to this DB from PHP script and from PhpMyadmin all worked correct. I was confused .
So, but when I tried to connect to other DB from NodeJS - all worked correct too. I could not understand what the problem. I tried all options for connection which described in your module but nothing could help me. This is a trace/debug/verbose :

$ node runsimulator.js
<-- HandshakeInitializationPacket
{ protocolVersion: 10,
  serverVersion: '5.5.25-log',
  threadId: 2139504,
  scrambleBuff1: <Buffer 4d 3d 28 4f 36 5f 5c 30>,
  filler1: <Buffer 00>,
  serverCapabilities1: 63487,
  serverLanguage: 8,
  serverStatus: 2,
  serverCapabilities2: 32783,
  scrambleLength: 21,
  filler2: <Buffer 00 00 00 00 00 00 00 00 00 00>,
  scrambleBuff2: <Buffer 78 2e 7a 3e 64 5d 29 4e 30 44 46 70>,
  filler3: <Buffer 00>,
  pluginData: 'mysql_native_password\u0000' }

--> ClientAuthenticationPacket
{ clientFlags: 193487,
  maxPacketSize: 0,
  charsetNumber: 33,
  filler: undefined,
  user: 'user',
  scrambleBuff: <Buffer b8 f4 63 92 6e 65 63 f9 f5 b6 74 ec c8 85 db 4d 7f 29 d5 25>,
  database: 'data_base' }

<-- ErrorPacket
{ fieldCount: 255,
  errno: 1045,
  sqlStateMarker: '#',
  sqlState: '28000',
  message: 'Access denied for user \'user\'@\'127.0.0.1\' (using password: YES)' }

{ [Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'user'@'127.0.0.1' (using password: YES)] code: 'ER_ACCESS_DENIED_ERROR', fatal: true }
Query error : Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'user'@'127.0.0.1' (using password: YES)

There is my code which I used :

var connection = mysql.createConnection('mysql://user:password@127.0.0.1:3306/data_base?debug=true');

    connection.connect(function(err){
        if (err) {
            console.log(err);
        }
    });
    connection.query("SET time_zone='+"+new Date().getTimezoneOffset()/60*(-1)+":00'", function(error, result) {
    if (error) {
        console.log('Query error : '+error);
    }
});

So, I tried use the object style for set params for connect but got the same result. Please help.
Help!

I used your connector and I like it but this situation was confused me and I really need help because I don't know what should do.

@jackleekr
Copy link

Hi ..
I just tried your source code on My Mac.
It's working without any error.

Test Env
mysql : mysql-5.5.22-osx10.6-x86_64
node.js mysql : npm install mysql@2.0.0-alpha3

My Test Source

var mysql = require('mysql');
var conn = mysql.createConnection('mysql://root:*******@localhost:3306/company?debug=true');

conn.connect(function(err){
if(err) console.log('connection error:', err);
});

conn.query('select * from products',function(err, rows){
if (err) console.log(err);

console.log('result :', rows);

});

conn.end();

I hope it could be a help to you

@ashalaenko
Copy link
Author

Not. This not help me. I know that your module works fine. I successfully connected to many other databases via your module. But I got this error with this db. Very interesting situation. I can connect to this db via php/python/java - but could not via your module. Maybe problem in user (user without grantable access - only usage). But why I can connect from php with this user.

@jackleekr
Copy link

I'm not sure why you face connection problems. However I have one thing to suggest you to try.. it's changing the password to simple character like "aaa111" , if there is any none alphabet or number in you password.

@ashalaenko
Copy link
Author

Not. This not help me too. I already tried it. I changed password to 111 and got the same.

@jackleekr
Copy link

mm. than unfortunately we need to wait for a reply from the developer of this module.
I'm also studying this module like you. I hope you could a good answer from the developer.

@ashalaenko
Copy link
Author

Yes, I hope too. Thanks.

@felixge
Copy link
Collaborator

felixge commented Jul 24, 2012

I had a close look, but not sure what is going on here. Is there any chance you can make this database available to me over the internet so I can take a deeper look? E-Mail me at felix (at) debuggable.com if you want to share some information on that privately.

@ashalaenko
Copy link
Author

Unfortunately I do not have the opportunity to provide you with access to this database as against the bosses.

@dresende
Copy link
Collaborator

Does this still fail on the latest version? 2.0.0-alpha3

@dresende
Copy link
Collaborator

dresende commented Nov 2, 2012

Reopen if it still fails..

@dresende dresende closed this as completed Nov 2, 2012
@mysqljs mysqljs deleted a comment from 3jFernando May 13, 2018
@mysqljs mysqljs deleted a comment from Muphet May 13, 2018
@mysqljs mysqljs deleted a comment from dresende May 13, 2018
@mysqljs mysqljs locked as spam and limited conversation to collaborators May 13, 2018
@dougwilson
Copy link
Member

I have locked this thread because we don't monitor issues closed many years ago. If you are having an issue, please open a new issue and explain what the issue is along with steps to reproduce so we can investigate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

5 participants