Drizzle <> MySQL
To use Drizzle with a MySQL database, you should use the mysql2
driver
According to the official website,
mysql2
is a MySQL client for Node.js with focus on performance.
Drizzle ORM natively supports mysql2
with drizzle-orm/mysql2
package.
Step 1 - Install packages
Step 2 - Initialize the driver and make a query
If you need to provide your existing driver:
Client connection
Pool connection
IMPORTANT
For the built in migrate
function with DDL migrations we and drivers strongly encourage you to use single client
connection.
For querying purposes feel free to use either client
or pool
based on your business demands.
What’s next?