Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Swift
  3. MySQL Swift

MySQL Swift

MITSwift0.9.5

A type-safe MySQL client library for Swift, inspired by Node.js mysql, with Codable result mapping.

GitHubGitHub
165 stars42 forks0 contributors

What is MySQL Swift?

mysql-swift is a MySQL client library for Swift that enables type-safe database interactions. It allows developers to execute raw SQL queries with proper escaping and map results directly to Swift's Codable types, reducing boilerplate and improving data integrity. The library is inspired by Node.js's mysql package and provides familiar query formatting.

Target Audience

Swift developers building server-side applications or tools that require MySQL database connectivity, particularly those who value type safety and Codable integration.

Value Proposition

Developers choose mysql-swift for its straightforward type-safe querying, Codable result mapping that eliminates manual row parsing, and its similarity to the popular Node.js mysql interface, making it intuitive for those with JavaScript experience.

Overview

A type safe MySQL client for Swift

Use Cases

Best For

  • Building Swift backend services that need MySQL database access
  • Projects requiring type-safe mapping between database rows and Swift models
  • Developers familiar with Node.js mysql who are transitioning to Swift
  • Server-side Swift applications on Linux or macOS
  • Applications that use raw SQL queries but want safety against injection
  • Prototyping or tools where Codable integration reduces development time

Not Ideal For

  • Projects requiring active maintenance or long-term support due to its obsolete and unmaintained status
  • Applications needing asynchronous I/O support for modern Swift concurrency models
  • Teams integrated with the Vapor ecosystem or using latest Swift frameworks where MySQLNIO is recommended

Pros & Cons

Pros

Type-Safe Querying

Executes raw SQL with parameterized inputs to prevent injection, as shown in query examples using QueryParameter for safe formatting.

Codable Integration

Automatically maps database rows to Swift structs or classes via Codable, reducing boilerplate for model mapping, demonstrated in the User struct example.

Familiar Query Formatting

Uses Node.js-style query formatting with placeholders like '?', making it intuitive for developers transitioning from JavaScript's mysql library.

Connection Pooling

Includes built-in connection pools via ConnectionPool for efficient database resource management, as outlined in the usage section.

Cons

Obsolete and Unmaintained

The README explicitly states it's obsolete and not maintained, directing users to MySQLNIO, meaning no future updates, bug fixes, or security patches.

No Asynchronous Support

Lacks asynchronous I/O support, relying on synchronous libmysqlclient calls, which limits compatibility with Swift's modern async/await patterns.

Complex macOS Setup

Requires installing specific pkg-config files via Homebrew taps (e.g., cmysql), adding setup complexity compared to more integrated solutions.

Limited Driver Dependency

Depends solely on libmysqlclient, which can restrict performance optimizations and features available in other database drivers.

Frequently Asked Questions

Quick Stats

Stars165
Forks42
Contributors0
Open Issues1
Last commit2 years ago
CreatedSince 2015

Tags

#database-driver#codable#type-safe#mysql#server-side-swift#mysql-client#linux#swift#macos#sql

Built With

l
libmysqlclient
S
Swift

Included in

Swift26.0k
Auto-fetched 9 hours ago

Related Projects

MySQLMySQL

A stand-alone Swift wrapper around the MySQL client library, enabling access to MySQL servers.

Stars126
Forks58
Last commit6 days ago
PostgreSQLPostgreSQL

A stand-alone Swift wrapper around the libpq client library, enabling access to PostgreSQL servers.

Stars53
Forks19
Last commit6 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub