Skip to content

Error Connecting to Amazon RDS over SSL #1380

Closed

Description

I'm getting the following error connecting to Amazon RDS over SSL

ER_ACCESS_DENIED_ERROR: Access denied for user 'xxx'@'xxx.255.51.194' (using password: YES)

How do I use SSL ? Can I set it as {ssl:'Amazon RDS'} like below or do I need to explicitly set the .pem ?

var sequelize = new Sequelize('mydb', 'foo', 'pwd', {
host: 'mydb.xxxxx.us-west-2.rds.amazonaws.com',
port: 3306,
ssl:'Amazon RDS'});

Accessing RDS from the terminal works fine ...

mysql -h mydb.xxxxx.us-west-2.rds.amazonaws.com --ssl_ca=/Users/ciaranbyrne/Dropbox/ActionFinish/mysql-ssl-ca-cert.pem -P 3306 -u foo -p

Activity

  1. mickhansen commented on Feb 11, 2014

    @mickhansen
    Contributor

    I don't know if node-mysql actually supports SSL.
    Edit: I see that it does. To pass options along specifically to the mysql driver you need to use dialectOptions

  2. janmeier commented on Feb 11, 2014

    @janmeier
    Member

    Have you tried

    new Sequelize(..., {
      dialectOptions: {
        ssl: 'Amazon RDS'
      }

    Everything in dialectOptions is passed directly to node-mysql

  3. janmeier commented on Feb 11, 2014

    @janmeier
    Member

    By the way the Amazon RDs certificate seems to be a pretty recent addition to node-mysql, so perhaps you needs to update?

  4. janmeier commented on Feb 11, 2014

    @janmeier
    Member

    The RDS ssl profile is not published in npm yet.
    Added 7 days ago mysqljs/mysql@060185d

    While the node mysql package was last updated a month ago https://www.npmjs.org/package/mysql

    You should point your package at their github repo or bug them to publish a new version :)

  5. janmeier commented on Feb 11, 2014

    @janmeier
    Member

    Does it work if you try to create a connection directly using node mysql?

  6. mickhansen commented on Feb 12, 2014

    @mickhansen
    Contributor

    Great!

  7. shubhamagarwal90 commented on Oct 9, 2016

    @shubhamagarwal90

    Hello

    I am trying to connect to mysql database in Amazon RDS with Node, and its failing mentioning the reason as
    "{"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":3306,"fatal:true"}"

    The code I have written is

    var con = mysql_db.createConnection({
    database: 'OCOC',
    hostname: 'ococ.xxxxxxxx.ap-southeast-1.rds.amazonaws.com:3306',
    //port: '3306',
    username: 'xxxxxx',
    password: 'xxxxxxx',
    dialectOptions: {ssl:'Amazon RDS'}
    });

    con.connect(function(err) {
        if (err ) {
            console.log(JSON.stringify(err));        }
        else {
            console.log('Connection established');
        }
    

    });

    Directly giving ssl was not working, so after reading your post I added dialectOptions, but the issue still not resolved. Even if I remove the ssl command still it fails.

    Hope you might give me some insight as I am stuck with it for 2 days now. Also without adding ssl it is getting connected from cmd.

  8. felixfbecker commented on Oct 9, 2016

    @felixfbecker
    Contributor

    @shubhamagarwal90 That isn't Sequelize code

  9. gustaflindqvist commented on May 10, 2017

    @gustaflindqvist

    Is it still a dead-end to getting Sequelize.js to work with Amazon RDS?

  10. vedran-maricevic commented on Jul 3, 2018

    @vedran-maricevic

    What do we put in this setting:

     dialectOptions: {
        ssl:'Amazon RDS'
    },
    

    Just an Amazon RDS? Or Certificate?

  11. hitautodestruct commented on Sep 26, 2018

    @hitautodestruct

    @wexoni Just this will do:

     dialectOptions: {
        ssl:'Amazon RDS'
    },
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions