{"id":13514085,"url":"https://github.com/planetscale/sql-proxy","last_synced_at":"2025-03-31T02:33:20.466Z","repository":{"id":37091286,"uuid":"327402663","full_name":"planetscale/sql-proxy","owner":"planetscale","description":"SQL Proxy for PlanetScale DB","archived":true,"fork":false,"pushed_at":"2023-12-11T12:29:18.000Z","size":4539,"stargazers_count":54,"open_issues_count":10,"forks_count":6,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-01T17:37:19.550Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/planetscale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-06T18:52:28.000Z","updated_at":"2024-10-23T07:51:02.000Z","dependencies_parsed_at":"2024-01-13T19:41:34.388Z","dependency_job_id":null,"html_url":"https://github.com/planetscale/sql-proxy","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsql-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsql-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsql-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fsql-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/planetscale","download_url":"https://codeload.github.com/planetscale/sql-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246407401,"owners_count":20772126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T05:00:45.963Z","updated_at":"2025-03-31T02:33:16.769Z","avatar_url":"https://github.com/planetscale.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# sql-proxy [![Build status](https://badge.buildkite.com/ca3f602492e4918255dec82c84067f2bb2349d4a4cb85600fe.svg?branch=main)](https://buildkite.com/planetscale/sql-proxy)\n\nThe SQL Proxy allows a user with the appropriate permissions to connect to a\nPlanetScale database without having to deal with IP whitelisting or SSL\ncertificates manually. It works by opening unix/tcp sockets on the local\nmachine and proxying connections to the associated Database instances when the\nsockets are used.\n\n# NOTE\nThis repo has been deprecated in favour of using the normal `pscale` CLI client in a container, and passing it the `connect` command with the `host` flag, which will do the same thing\n\n## Installation\n\n**homebrew tap** (only on macOS for now):\n\n```\nbrew install planetscale/tap/pscale-proxy\n```\n\n**deb/rpm**:\n\nDownload the .deb or .rpm from the [releases](https://github.com/planetscale/sql-proxy/releases/latest) page and install with dpkg -i and rpm -i respectively.\n\n**manually**:\n\nDownload the pre-compiled binaries from the [releases](https://github.com/planetscale/sql-proxy/releases/latest) page and copy to the desired location.\n\n## Usage\n\nAuthenticate with [`pscale`](https://github.com/planetscale/cli):\n\n```\npscale auth login\n```\n\nRun the proxy by passing your organization, database and the branch you want to connect:\n\n```\nsql-proxy-client --token \"$(cat ~/.config/planetscale/access-token)\" --org \"org\" --database \"db\" --branch \"branch\" \n```\nThis will run the `sql-proxy-client` on your localhost and bind to the address\n`127.0.0.1:3307`. You should use this address to connect your application. As\nan example, here is how you can connect with the `mysql` CLI:\n\n```\nmysql -u root -h 127.0.0.1 -P 3307\n```\n\n### Connecting with a Service token\n\nTo connect with a service token and service token name, use the following flags:\n\n```\nsql-proxy-client --service-token \"\u003cyour_service_token\u003e\" --service-token-name \"\u003cyour_service_token_name\u003e\" --org \"org\" --database \"db\" --branch \"branch\" \n```\n## Using the Docker container\n\nWe also provide ready to use containers. To pull the latest docker image:\n\n```\ndocker pull planetscale/pscale-proxy:latest\n```\n\nHere is an example to run the container and publish the proxy on host address\n`127.0.0.1:3306:`\n\n```\n$ docker run -p 127.0.0.1:3306:3306 planetscale/pscale-proxy \\\n  --host 0.0.0.0 \\\n  --org \"$PLANETSCALE_ORG\" \\\n  --database \"$PLANETSCALE_DATABASE\" \\\n  --branch \"$PLANETSCALE_BRANCH\" \\\n  --service-token \"$PLANETSCALE_SERVICE_TOKEN\" \\\n  --service-token-name \"$PLANETSCALE_SERVICE_TOKEN_NAME\" \n```\n\n## Credits\n\nThe `sql-proxy` project was inspired by the [`cloud_sql_proxy`](https://github.com/GoogleCloudPlatform/cloudsql-proxy/) project. Because the proxy is meant to be used with PlanetScale Database, the following parts were rewritten from scratch:\n\n* Authentication\n* Certificate Source\n* Mapping of applications to database instances\n\nWe also simplified the code base towards our own needs. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fsql-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplanetscale%2Fsql-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fsql-proxy/lists"}