This project is a simple command-line CRUD (Create, Read, Update, Delete) application developed in C++ that connects to a docker container with a MySQL database using MySQL Connector/C++. The project demonstrates basic operations such as adding, reading, updating, and deleting records in a database table.
- Create new records in the database.
- Read all records or a specific record by ID.
- Update existing records.
- Delete records by ID.
- Command-line interface for interacting with the database.
Before running this project, ensure you have the following installed on your system:
- C++ compiler (with C++14 or higher support)
- CMake (for building the project)
- MySQL (local instance or Docker container)
- MySQL Connector/C++ (for database connection)
- Docker (for database populating and hosting)
git clone https://github.com/your-username/cpp-client-server-connection.git
cd cpp-client-server-connectionMake sure you have installed MySQL Connector/C++. If you're using Homebrew on macOS, you can install it using:
brew install mysql-connector-c++Run the following script to start the docker containter:
docker compose up -dOr in earlier versions:
docker-compose up -dRun the script in set_env.sh to set database environment variables:
source set_env.shConfigure and build the project using CMake:
mkdir build
cd build
cmake ..
makeAfter building the project, run the executable:
./crud_appA video demonstration of the program in action can be found here.