dbTalk Databases Forums  

Connection failure only with a password

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Connection failure only with a password in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jack@yankeeboysoftware.com
 
Posts: n/a

Default Connection failure only with a password - 08-13-2006 , 06:01 AM






Hello,

I am having a strange problem with connecting and I can't find any
information which indicates I am doing anything wrong.

I have this sample code:


int main(int argc, char* argv[])
{

cout << "Hello!" << endl;

try {

Connection connect("blog","10.0.0.1", "test_user","");

string querystr = "select * from test";

Query query = connect.query();
query << querystr;

Result res = query.store();
Row row;
Result::iterator iter;

for (iter = res.begin(); iter != res.end(); iter++) {
row = *iter;
cout << (const char*)row[(unsigned int)0] << endl;
}

}
catch (mysqlpp::Exception x) {
cerr << "MySQL Generated an error: " <<
x.what() << endl;
return -1;
}

return 0;
}


If I use a username that has a password, I always generate this error:
MySQL Generated an error: Access denied for user: 'with_pass@my_server'
(Using password: YES)

however, changing the user to one with no password (and providing an
empty string for the password) works correctly

Can someone please point me in the right direction, or explain what I
am missing or doing wrong.


Reply With Quote
  #2  
Old   
jack@yankeeboysoftware.com
 
Posts: n/a

Default Re: Connection failure only with a password - 08-18-2006 , 08:35 AM






Problem solved.

This appears to be an issue with the use of the login hosts allowed. I
had set test_user up to log in from 'Any'. When I specify a specific
host, this problem disappears


jack (AT) yankeeboysoftware (DOT) com wrote:
Quote:
Hello,

I am having a strange problem with connecting and I can't find any
information which indicates I am doing anything wrong.

I have this sample code:


int main(int argc, char* argv[])
{

cout << "Hello!" << endl;

try {

Connection connect("blog","10.0.0.1", "test_user","");

string querystr = "select * from test";

Query query = connect.query();
query << querystr;

Result res = query.store();
Row row;
Result::iterator iter;

for (iter = res.begin(); iter != res.end(); iter++) {
row = *iter;
cout << (const char*)row[(unsigned int)0] << endl;
}

}
catch (mysqlpp::Exception x) {
cerr << "MySQL Generated an error: "
x.what() << endl;
return -1;
}

return 0;
}


If I use a username that has a password, I always generate this error:
MySQL Generated an error: Access denied for user: 'with_pass@my_server'
(Using password: YES)

however, changing the user to one with no password (and providing an
empty string for the password) works correctly

Can someone please point me in the right direction, or explain what I
am missing or doing wrong.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.