src/content/docs/get-started/planetscale-postgres-new.mdx
import Tab from '@mdx/Tab.astro'; import Tabs from '@mdx/Tabs.astro'; import Npm from "@mdx/Npm.astro"; import Callout from '@mdx/Callout.astro'; import Steps from '@mdx/Steps.astro'; import AnchorCards from '@mdx/AnchorCards.astro'; import Breadcrumbs from '@mdx/Breadcrumbs.astro'; import Prerequisites from "@mdx/Prerequisites.astro"; import CodeTabs from "@mdx/CodeTabs.astro"; import FileStructure from '@mdx/get-started/FileStructure.mdx'; import InstallPackages from '@mdx/get-started/InstallPackages.mdx'; import ConnectPlanetScalePostgres from '@mdx/get-started/postgresql/ConnectPlanetScalePostgres.mdx' import CreateTable from '@mdx/get-started/postgresql/CreateTable.mdx' import SetupConfig from '@mdx/get-started/SetupConfig.mdx'; import ApplyChanges from '@mdx/get-started/ApplyChanges.mdx'; import RunFile from '@mdx/get-started/RunFile.mdx'; import QueryDatabase from '@mdx/get-started/QueryDatabase.mdx'; import SetupEnv from '@mdx/get-started/SetupEnv.mdx';
<Breadcrumbs/>PlanetScale offers both MySQL (Vitess) and PostgreSQL databases. This guide covers connecting to PlanetScale Postgres using the standard node-postgres driver.
For detailed instructions on creating a PlanetScale Postgres database and obtaining credentials, see the PlanetScale Postgres documentation.
<FileStructure/>Create a .env file in the root of your project and add your database connection variable:
DATABASE_URL=postgresql://{username}:{password}@{host}:{port}/postgres?sslmode=verify-full