I'm setting up a NodeJS backend in Google App Engine, and when I try to connect to the SQL Cloud (using sequelize + postgres) , I'm getting this error:

Unhandled rejection SequelizeConnectionError: connect ENOENT /cloudsql/tar:us-central1:dbpointofsales/.s.PGSQL.5432
    at connection.connect.err (/home/mf/backend/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:182:24)
    at Connection.connectingErrorHandler (/home/mf/backend/node_modules/pg/lib/client.js:163:14)
    at Connection.emit (events.js:182:13)
    at Socket.reportStreamError (/home/mf/backend/node_modules/pg/lib/connection.js:71:10)
    at Socket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
New contributor
Martin Degraf is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Connect ENOENT means that the system cannot connect to mysql because its path is incorrect. Update the models / index.js files with the specified code. To find your path to the mysql socket, go to the file here /etc/mysql/my.cnf(this path may depend on your server). Example, /etc/my.cnf. Here you will find the path of the socket.

Please veritfy, it needs administer rights (sudo on ubuntu). Confirm the login credentials are correct, the port is open.

You have to verify the setting up a connection, and the you can try confirm the connection.

Testing the connection



.then(() => {

console.log('Connection has been established successfully.');


.catch(err => {

console.error('Unable to connect to the database:', err);


The module mysql with a key socketPath.

var sequelize = new Sequelize("database", username, password, {

host: "localhost",

dialect: "mysql",

logging: function () {},

pool: {

    max: 5,

    min: 0,

    idle: 10000


dialectOptions: {

    socketPath: "/var/run/mysqld/mysqld.sock"


define: {

    paranoid: true



Your Answer

Martin Degraf is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.