0

I am trying to connect my microservice with the CloudSQL instance via casbin-sequelize-adapter. Following is the code -

 await SequelizeAdapter.newAdapter({
    username: process.env.DB_USER,
    password: process.env.DB_PASS,
    database: process.env.DB_NAME,
    dialect: 'mysql',
    host: `${dbSocketPath}/${process.env.INSTANCE_CONNECTION_NAME}`,
    dialectOptions: {
      socketPath: `${dbSocketPath}/${process.env.INSTANCE_CONNECTION_NAME}`
    },
    pool: {
      max: 5,
      min: 0,
      acquire: 30000,
      idle: 10000
    },
    logging: false,
    operatorsAliases: false
  })

The error that I am getting:

  code: 'ER_ACCESS_DENIED_ERROR',
    errno: 1045,
    sqlState: '28000',
    sqlMessage: "Access denied for user 'root'@'cloudsqlproxy~35.208.115.84' (using password: YES)",
    sql: undefined

What I have tried: The pasword and username contains no special characters Via CloudSQL proxy I am able to set up connection with the Cloud SQL Instance. I tried whitelisting the above IP in the Cloud SQL networks.

Can anyone suggest what can be the things that have caused this issue?

Shobit Jain
  • 308
  • 2
  • 14

1 Answers1

0

That error is a permissions error inside your database and means that you're either providing the wrong password or that your database doesn't allow root to connect from that host.

I'd suggest verifying your credentials by logging in through a separate path.

enocom
  • 1,496
  • 1
  • 15
  • 22