Study/에러 정리

MySQL - Connector/C++ 접속 에러

Juzdalua 2024. 8. 30. 15:44

MySQL에 접속하려니까 Unable to connect to 3306 에러가 발생했다.

sql::Driver* driver = get_driver_instance();
std::unique_ptr<sql::Connection> conn(driver->connect(server, name, password)); // ERROR

 

로컬에 MySQL 서버는 켜져있고

GUI 툴로 접속되서 데이터 확인도 되고

cmd로 접속해서 데이터도 확인되는데 접속이 안됐다.

 

오늘도 두어시간 GPT와 삽질하며 헤매고 있는데

외국 형님 두분께서 도움을 주셨다.

스킵하며 보다보니 왜 릴리즈 모드에서 하는지 궁금했는데

스택오버플로우에서 해결해줬다.

ㅠㅠ...

 

디버그모드는 디버그모드용 라이브러리를 별도로 다운받아야한다.

 

참고)

https://stackoverflow.com/questions/76041337/mysql-c-connector8-jdbc-unable-connect-to-localhost

 

mysql c++ connector8 jdbc, unable connect to localhost

mysql -uroot -p123456 i can connect to mysql with a terminal. but when i use the mysql c++ connector with jdbc, it fails. The exception says "unable to connect to localhost".

stackoverflow.com

 

https://www.youtube.com/watch?v=a_W4zt5sR1M