Skip to content

Instantly share code, notes, and snippets.

@Deri-Kurniawan
Created November 16, 2023 06:15
Show Gist options
  • Save Deri-Kurniawan/ef91222e72a19e22d5a2ce048b68fb72 to your computer and use it in GitHub Desktop.
Save Deri-Kurniawan/ef91222e72a19e22d5a2ce048b68fb72 to your computer and use it in GitHub Desktop.
Guide to creating your mysql connection using URL

Here's a clearer explanation of the structure of the base URL and path with placeholder values, along with implementation examples and an additional example for adding connection timeout:

Base URL Structure:

mysql://USER:PASSWORD@HOST:PORT/DATABASE?KEY1=VALUE&KEY2=VALUE&KEY3=VALUE

Example with Placeholder Values:

mysql://root:mypassword123@localhost:3306/my_database_name

Example with Connection Timeout:

mysql://root:mypassword123@localhost:3306/my_database_name?connect_timeout=5

more optional query example: https://www.prisma.io/docs/concepts/database-connectors/mysql#connection-details

Sources: prisma.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment