cloud_sql_proxy command not found

In this troubleshooting guide we learn how to fix cloud_sql_proxy command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

cloud_sql_proxy: command not found

or when using sudo you get the following error message

sudo: cloud_sql_proxy: command not found

Solutions to cloud_sql_proxy: command not found

How To Fix cloud_sql_proxy: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu cloud_sql_proxy is provided by cloudsql-proxy package.

cloudsql-proxy is:

The Cloud SQL Proxy allows a user with the appropriate permissions to connect to a Second Generation Google Cloud SQL database without having to deal with IP whitelisting or SSL certificates manually. It works by opening unix/tcp sockets on the local machine and proxying connections to the associated Cloud SQL instances when the sockets are used.

Optional functionality can be enabled (–fuse) with access to /dev/fuse as well as the fusermount binary.

By default, the proxy will authenticate under the default service account of the Compute Engine VM it is running on. Therefore, the VM must have at least the sqlservice.admin API scope (“https://www.googleapis.com/auth/sqlservice.admin") and the associated project must have the SQL Admin API enabled. The default service account must also have at least WRITER/EDITOR privileges to any projects of target SQL instances.

To fix this problem, we can install more using the command below.

sudo apt-get -y install cloudsql-proxy

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install cloudsql-proxy.

sudo apt -y install cloudsql-proxy

Or if you have aptitude installed you can use the following command.

sudo aptitude install cloudsql-proxy

Summary

In this tutorial we learn how to fix cloud_sql_proxy command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.