int main()
{
MYSQL *connect;
MYSQL_RES *result;
MYSQL_ROW row;
connect = mysql_init(NULL);
if (mysql_real_connect(connect,"localhost","root","","kompjuterska_oprema",0,NULL,0) !=0)
{
cout << "Succesfully Connected to MySQL database " << endl;
}
else
{
cout << "Was not able to connect to database";
}
mysql_close(connect);
system("pause");
return 0;
}
Can you help me? Њhere is my mistake?
You gave the wrong input to the connect function. The standard format is
mysql_real_connect(handle, host, user, password, database, ...) you assigned 0 to database. My guess is, you ignored the password field, the current password being "kompjuterska_oprema". Have phun!