我在使用 mysql-connector-c++ 8.0 后遇到了很大的困难,现在我输入的 uri 正如他们在文档中提到的那样,但连接被拒绝。
医生怎么说:
Client cli("user:password@host_name/db_name", ClientOption::POOL_MAX_SIZE, 7);
我的代码:
_mysql_client = std::make_unique<mysqlx::Client>("mysqlx://root:asdasd@localhost/asdasd");
try {
mysqlx::Session s = _mysql_client->getSession();
CoreLog->info("Successfully connected to mysql server on {}.", conn_uri);
} catch (const mysqlx::Error &err) {
CoreLog->info("Could not connect to mysql server on {} due to {}.", conn_uri, err.what());
}
我得到这个错误
[20:34:36.993] Core: Could not connect to mysql server on root:asdasd@localhost/asdasd due to CDK Error: Connection refused (generic:61).
这里有什么问题?