
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@google-cloud/cloud-sql-connector
Advanced tools
A JavaScript library for connecting securely to your Cloud SQL instances
The Cloud SQL Node.js Connector is a Cloud SQL connector designed for use with the Node.js runtime. Using a Cloud SQL connector provides the following benefits:
The Cloud SQL Node.js Connector is a package to be used alongside a database driver. Currently supported drivers are:
pg (PostgreSQL)You can install the library using npm install:
npm install @google-cloud/cloud-sql-connector
The connector package is meant to be used alongside a database driver, in the
following example you can see how to create a new connector and get valid
options that can then be used when starting a new
pg connection pool.
import pg from 'pg';
import {Connector} from '@google-cloud/cloud-sql-connector';
const { Pool } = pg;
const connector = new Connector();
const clientOpts = await connector.getOptions({
instanceConnectionName: 'my-project:region:my-instance',
type: 'PUBLIC'
});
const pool = new Pool({
...clientOpts,
user: 'my-user',
password: 'my-password',
database: 'db-name',
max: 5
});
const result = await pool.query('SELECT NOW()');
await pool.end();
connector.close()
Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.
Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:
This library follows Semantic Versioning.
This library is considered to be at preview, ready for testing by customers.
More Information: Google Cloud Platform Launch Stages
Contributions welcome! See the Contributing Guide.
Apache Version 2.0
See LICENSE
mysql2 is a popular MySQL client for Node.js that supports both callbacks and promises. While it provides robust functionality for connecting to MySQL databases, it does not offer built-in support for Google Cloud SQL's specific authentication and connection management features like @google-cloud/cloud-sql-connector.
pg is a PostgreSQL client for Node.js. It offers a wide range of features for connecting to and interacting with PostgreSQL databases. Similar to mysql2, it does not include specific support for Google Cloud SQL's authentication and connection management, which @google-cloud/cloud-sql-connector provides.
knex is a SQL query builder for Node.js that supports multiple database types, including MySQL and PostgreSQL. It provides a flexible and powerful way to build and execute SQL queries. However, it lacks the specialized connection management and authentication features for Google Cloud SQL that @google-cloud/cloud-sql-connector offers.
FAQs
A JavaScript library for connecting securely to your Cloud SQL instances
The npm package @google-cloud/cloud-sql-connector receives a total of 782,817 weekly downloads. As such, @google-cloud/cloud-sql-connector popularity was classified as popular.
We found that @google-cloud/cloud-sql-connector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.