Build C/C++ Applications Using MySQL Connector and Visual Studio 2022 | Connect C/C++ to MySQL

BoostMyTool · 143K views · 2021 · 5:44

Open on YouTube

C, C++, Rust, Go & systems languagesDatabases & storageTesting, debugging & developer toolstutorialdated

Why Stack Overflow recommends it

Stack Overflow users cite it when setting up MySQL Connector/C++ in Visual Studio, usually while asking about linker errors and build configuration.

Recommended by 0 people across 0 different months, 2022 to 2023.

What it is

A short Windows tutorial showing how to build a C/C++ program that talks to a MySQL database using MySQL Connector/C++ and Visual Studio 2022. It covers setting up the project and linking the connector, following Microsoft's Azure MySQL C++ sample. The channel is BoostMyTool.

What people said

Cites Kuba103 · 2022-06 · Stack Overflow · on “MySQL connector with Cmake C++”

I am trying to build a simple app that inserts data into a database. I am not sure what the Cmake file should look like. I've downloaded mysql-connector-c++ zip, unpacked it and placed it inside the project directory. cmake_minimum_required(VERSION 3.22) project(inserting_database) set(CMAKE_CXX_STANDARD 23) include_directories(mysql-connector-c++) include_directories(mysql-connector-c++/include/jdbc/cppconn) link_directories(mysql-connector-c++/lib64/vs14) add_executable(insert_debug main.cpp) target_link_libraries(insert_debug curl mysql-connector-c++) in the main I have included #include "include/jdbc/mysql_connection.h" #include <driver.h> #include <exception.h> #include <prepared_statem

Cites Anonymous · 2022-07 · Stack Overflow · on “LNK2019 error when building MySQL codei n VIsual Studio C++”

I've spent about two days now trying to get this to work but I still keep getting the same error with every method I do. I'm new to connecting MySQL to C++ so I'm a bit lost and every time I try to compile it, the thing spits out LNK2019 error. I'm using Visual Studio 2022. #include <iostream> #include <mysql.h> using namespace std; // DATABASE STUFF struct connection_details { const char* server, * user, * password, * database; }; MYSQL* mysql_connection_setup(struct connection_details mysql_details) { MYSQL* connection = mysql_init(NULL); if (!(mysql_real_connect(connection, mysql_details.server, mysql_details.user, mysql_details.password, mysql_details.database, 0, NULL, 0))) { cout << "C

Cites StreakerOne · 2023-01 · Stack Overflow · on “MySQL C++ connector in MVS2019 issue”

I am using this tutorial [this video] to make simple C++ app that connects to a database. I am using Microsoft visual studio 2019, and the guy uses mvs2022, so it is not working for me, there are 6 errors, all of them are LNK2028: unresolved external symbol. Is there anything that i should do differently for my version of visual studio than it says in video? Edit: i downloaded x86 lib, now it says "cant open mysqlcppconn-static.lib"