I am trying to connect to a Cloud SQL instance from a nodejs application using the pem file key.
var fs = require('fs'); var Sequelize = require('sequelize'); var sequelize = new Sequelize('database', 'root', '', { host: '<ip>', dialect: 'mysql', ssl: { ca: fs.readFileSync(__dirname + '/server-ca.pem'), key: fs.readFileSync(__dirname + '/cert.pem') } }); sequelize.query('select * from Users').then(function (users) { console.log(users); });
I have received Possibly unhandled SequelizeAccessDeniedError: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'<ip>' (using password: NO).
Possibly unhandled SequelizeAccessDeniedError: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'<ip>' (using password: NO)
What am I doing wrong?
It looks like your ssl options are wrong. You put the "cert" file in the parameter key. Your ssl configuration should look like this:
key
ssl: { ca: fs.readFileSync(__dirname + '/server-ca.pem'), cert: fs.readFileSync(__dirname + '/client-cert.pem'), key: fs.readFileSync(__dirname + '/client-key.pem') }
If client-key.pem is the private key corresponding to client-cert.pem. You should get all three of these files by following Cloud SQL SSL instructions .
Google mysql access denied using password no, MySQL , , , . (CTRL + F " " ). , .
mysql access denied using password no
Cloud SQL ? , , IP- IP- . , , NAT, , , / -, , IP- node , IP- . , dig +short myip.opendns.com @resolver1.opendns.com, , , IP-.
dig +short myip.opendns.com @resolver1.opendns.com
TLS Cloud SQL, , , .