MySQL Forums :: MySQL & Embedded Databases :: access denied

Advanced Search

access denied
Posted by: Aaron Kerti ()
Date: June 12, 2012 06:47PM

Hi, I'm using the c api and trying to access data off my mysql server(which is remote). When I try to connect it says access denied for user. How do I fix this? Is it something wrong with my server or code?

#include "stdafx.h"
#include <iostream>

#include <my_global.h>
#include <mysql.h>

using namespace std;

int main()
MYSQL *conn;
MYSQL_RES *result;

std::cout << "start" << std::endl;

conn = mysql_init(NULL);

if(conn == NULL)
std::cout << "failed to initialize connection" << std::endl;

mysql_real_connect(conn, "", "username", "password", "a1298_userAccounts", 0, "2082", 0);
cout << mysql_error(conn) << endl;

int query_result = mysql_query(conn, "SELECT * FROM UserAccounts");
std::cout << query_result << std::endl;

result = mysql_store_result(conn);

while ((row = mysql_fetch_row(result)))
std::cout << row[2] << std::endl;

if(row[2] == "shadyvillian")
if(row[3] == "a")
std::cout << "login successful" << std::endl;




Options: ReplyQuote

Subject Written By Posted
access denied Aaron Kerti 06/12/2012 06:47PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.