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:
https://mariadb.com/kb/en/about-mariadb-connector-c/#installing-mariadb-connectorc
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:
https://ziglang.org/documentation/master/#C
3 Likes
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
5 Likes
Recently I add a MySQL recipe for zig cookbook, hope it helps.
https://zigcc.github.io/zig-cookbook/14-03-mysql.html
4 Likes
can you please add an ‘examples’ folder
I might be a little late here(not very active in this platform).
If you have yet to get it to work, you might find this useful:
Feel free to raise issues in github should you have any