msyql connnector/c++ , to change connect port

#define DBHOST "tcp://127.0.0.1:3306"

#define USER "root"
#define PASSWORD "admin"
#define DATABASE "test"
	string url(argc >= 2 ? argv[1] : DBHOST);
	const string user(argc >= 3 ? argv[2] : USER);
	const string password(argc >= 4 ? argv[3] : PASSWORD);
	const string database(argc >= 5 ? argv[4] : DATABASE);
	try {
		driver = get_driver_instance();

		/* create a database connection using the Driver */
		con = driver -> connect(url, user, password);
。。。

你可能感兴趣的:(C++,数据库)