Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
mysql/mysql.h
✓ #include <mysql/mysql.h>
Connect to a MySQL database
#include <mysql/mysql.h>
#include <iostream>
int main() {
MYSQL *conn = mysql_init(NULL);
if (conn == NULL) {
std::cerr << "mysql_init failed" << std::endl;
return 1;
}
if (mysql_real_connect(conn, "localhost", "user", "password", "database", 0, NULL, 0) == NULL) {
std::cerr << mysql_error(conn) << std::endl;
mysql_close(conn);
return 1;
}
std::cout << "Connected to MySQL" << std::endl;
mysql_close(conn);
return 0;
}
Audit
Dependencies
No dependency data recorded yet.
Resources
No resource links recorded.