Closed azoom-joseph-hagan closed 6 months ago
Hi @azoom-joseph-hagan! Thank you for your report.
tbls does not support Planetscale. From the error it looks like a secure connection error, but I have no way to confirm this.
If you can show me the Go code that allows you to connect to Planetscale, I might be able to find out something.
Thank you for the quick reply.
I'm not using Go directly myself, but looking at the Planetscale Documentation it seems to connect like this:
`.env`
DSN=username:password@tcp(aws.connect.psdb.cloud)/dbname?tls=true&interpolateParams=true
`main.go`
package main
import (
"database/sql"
"log"
"os"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", os.Getenv("DSN"))
if err != nil {
log.Fatalf("failed to connect: %v", err)
}
defer db.Close()
if err := db.Ping(); err != nil {
log.Fatalf("failed to ping: %v", err)
}
log.Println("Successfully connected to PlanetScale!")
}
Thank you again for your time and help.
Thank you.
If it can connect with
username:password@tcp(aws.connect.psdb.cloud)/dbname?tls=true&interpolateParams=true
then tbls will connect with
mysql://username:password@aws.connect.psdb.cloud/dbname?tls=true&interpolateParams=true
.
Thank you so much. That worked. Here is the final working code for connecting PlanetScale DB To tabls for future reference:
# DSN (Database Source Name) to connect database
dsn: mysql://username:password@aws.connect.psdb.cloud/dbname?tls=true&interpolateParams=true
# Path to generate document
docPath: doc/schema
What happened
I tried to connect to a Planetscale MySQL database using a .tbls.yml file in my project root like below but could not connect with tbls.
What you expected to happened
To be able to generate a document for my database.
What stack trace or error message from tbls did you see?
Anything else we need to know?
If I change the ssl accept to
?ssl={"rejectUnauthorized":true}
it still gets the same error.It works with a locally hosted MySQL database running in a Docker container so the issue lies with Planetscale's SSL/TSL policies.
Environment
MacOS: 14.4.1 (23E224) tbls v1.73.3
Is there anyway I can use tbls with my Planetscale Database?
Thank you.