Skip to content

Connection strings

Create reusable connection strings to connect to your PlanetScale database.

Creating a password

  1. To create a password, head to your database overview page at https://app.planetscale.com/<organization>/<database-name> and click on the Connect dropdown.

Database overview pageDatabase overview page

  1. On this dialog, click on Generate new password to create a new password to connect to the main branch of your database. We will then generate a unique username & password pair for you that will not be repeated and can be used to only access the main branch of your database.

Generate a new passwordGenerate a new password

  1. Once created, you can browse the connection string in different framework formats.
Note
You can connect to PlanetScale from any platform that supports mysql. These connection strings are in place to let you hit the ground running, please let us know if we're missing your favorite framework in this list. We support pre-generating connection strings for Go, Java, .Net, PHP, Prisma, Python, Rails and Rust.

Browse connection string in formatsBrowse connection string in formats

Tip
Make sure you copy the connection string for your application and the "General" format. We don't save the password in clear text, so there's no way to retrieve the password after you leave this page.

Managing passwords

Once you've created the password, you can head over to the Passwords settings page available at Organization > Database > Settings > Passwords to manage them.

Tip
You can also create passwords for branches other than main on this page.

Manage passwords pageManage passwords page

Clicking on the ... icon on the row for your password allows you to Rename the password, and Delete it. Operations on a passwordOperations on a password

Renaming a password

Since the username & password pair is unique, the only metadata you can edit is the display name of the password. Rename a passwordRename a password

Deleting a password

Deleting a password will invalidate the username & password pair and disconnect any active clients using this password. Delete a passwordDelete a password

Note
Any active clients using a deleted password will be disconnected from PlanetScale within a reasonable amount of time and will lose all access to the database with the deleted password.

Native MySQL authentication support

Use the tools you're familiar with to connect to PlanetScale databases. PlanetScale supports both MySQL native authentication which is widely used to provide a secure connection to MySQL servers, and MySQL Caching SHA-2 authentication which is the most secure authentication mechanism to connect to MySQL. Based on your application needs and platform support, you can switch between the authentication modes, with the same password.

We recommend Arctype as an easy-to-use GUI. Arctype integrates with PlanetScale to let you connect to and switch between branches, create deploy requests, and more.

Strong security model

PlanetScale Passwords are created for use with a single database branch. This strong security model allows you to generate passwords that are tied to a branch, and cannot access data/schema from another branch.

Disconnect clients by deleting passwords

PlanetScale automatically disconnects clients that are using a deleted password. Head on over to the Organization > Database > Settings > Passwords page on your database branch to delete passwords for that branch.

No plain text password storage

PlanetScale only stores hashes and metadata about your database passwords. We do not store any passwords in plain text to add an extra layer of security to your database.

Note
In the event that you lose a password, we cannot recover it for you. We recommend creating a new password with the same access level.

GitHub Secret Scanning integration

All passwords and service tokens generated for use with PlanetScale databases are part of GitHub's Secret Scanning program. If any database passwords or service tokens are committed in plain text to any public GitHub repository, we will be notified and take corrective action to delete the access tokens and cut off their access.

Was this page useful?
Last updated on November 23, 2021
Help us improve this page
PrivacyTerms© 2021 PlanetScale Inc.