Skip to content

Instantly share code, notes, and snippets.

@agmezr
Last active February 4, 2020 20:28
Show Gist options
  • Save agmezr/006cab92898f2e9dc6300a994246b827 to your computer and use it in GitHub Desktop.
Save agmezr/006cab92898f2e9dc6300a994246b827 to your computer and use it in GitHub Desktop.
Steps to connect to mysql using cpp (Linux)
  1. Install mysqlconn-dev library, example for Debian: apt-get install libmysqlcppconn-dev
  2. Download mysqlconn library
  3. Download the generic tar or install directly for your favorite flavor
  4. Download and install boost. This lib is needed by mysqlconn.
  5. If using generic, uncompress and take note of where is located.
  6. Create a cpp file to test. You can use this example
  7. Compile including the needed libraries. For example if you used used the generic lib, it should be something like this:
g++ -o test -Ipath/to/connlib/include/jdbc -I/path/to/boost test.cpp -lmysqlcppconn
  1. Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment