Mysql drivers for zig

Hey there

I was thinking of using zig for a small web project. The backend is to be on planetscale and is mysql powered. I was thinking of using something like zap for the server. But I am not sure how the db connection would work.

Are there any mysql db drivers for zig?

I’m not aware of any MySQL/MariaDB drivers for Zig. However you should be able to achieve this by importing a C-based MySQL driver into your Zig codebase.

Here is the link for instructions on using the official MariaDB C connector:

So you will have to build it using C functions, then import those functions into your Zig codebase using the methods outlined in the documentation:


A little late to the party. I recently wrote a mysql/mariadb driver in native zig code. GitHub - speed2exe/myzql: MySQL and MariaDB driver in native Zig


Recently I add a MySQL recipe for zig cookbook, hope it helps.