Skip to content

MySQLPassword

Source: src/Planetscale/MySQL/MySQLPassword.ts

A PlanetScale password for accessing a MySQL database branch.

For PostgreSQL databases, use {@link PostgresRole} instead.

Reader password

const reader = yield* Planetscale.MySQLPassword("AppReader", {
database: "my-db",
role: "reader",
});

Writer password with TTL

const writer = yield* Planetscale.MySQLPassword("AppWriter", {
database: "my-db",
role: "writer",
ttl: 86400,
});

Admin password with IP allowlist

const admin = yield* Planetscale.MySQLPassword("Admin", {
database: "my-db",
role: "admin",
cidrs: ["203.0.113.0/24", "198.51.100.0/24"],
});