Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@nikolasburk @janpio
57 lines (38 sloc) 2.14 KB

MySQL data source connector

The MySQL data source connector connects Prisma to a MySQL database server.

Example

To connect to a MySQL database server, you need to configure a datasource block in your schema file:

datasource mysql {
  provider = "mysql"
  url      = env("MYSQL_URL")
}

// ... the file should also contain a data model definition and (optionally) generators

The fields passed to the datasource block are:

Find more information on the datasource fields here.

Data model mapping

The MySQL connector maps the scalar types from the data model to native column types as follows:

Data model MySQL
String TEXT
Boolean BOOLEAN
Int INT
Float FLOAT
Datetime TIMESTAMP

Connection details

Connection string

MySQL offers two styles of connection strings:

  • Key-value string: {user:'user', host:'localhost', schema:'world'}
  • Connection URI: mysql://user@localhost:3333

See the official documentation for details.

Configuration options

  • host: The IP address/domain of your database server, e.g. localhost.
  • port: The port on which your database server listens, e.g. 5432.
  • database: The name of the database.
  • user: The database user, e.g. admin.
  • password: The password for the database user.
  • ssl: Whether or not your database server uses SSL.
  • connection_limit (coming soon): The connection limit specifies the maximum number of simultaneous connections that Prisma might have open to your database. Default: 1.
You can’t perform that action at this time.