problem: mysql_real_connect() will not establish connection with a remote db using an actual ip
current state: mysql_real_connect() establishes connection with local database. I am using Visual Studio Community 2017 Version 15.9.3, MySQL Workbench 8.0 Version 8.0.13 and Connector.C++ 1.1
void test_local_connection()
{
MYSQL* conn;
conn = mysql_init(0);
conn = mysql_real_connect(conn, "localhost", "root", "password1", "schema1",
3306, NULL, 0);
if (conn)
cout << "connection establised" << endl;
else error("connection failed - check settings");
}
question: what specific arguments do I need to pass to mysql_real_connect() to establish connection with a remote db? Does connection have to be established with root and root password, or can the connection be established with my user and my corresponding password?
void test_server_connection()
{
MYSQL* conn;
conn = mysql_init(0);
conn = mysql_real_connect(conn, "actual.ip.address", "user", "password2", "schema2", 3306, NULL, 0);
if (conn)
cout << "connection establised" << endl;
else error("connection failed - check settings");
}