darkpunkcalob
New Member
- Messages
- 22
- Reaction score
- 0
- Points
- 0
So, when i try to connect to my mysql databases, i get this error:
So my question: Is there something I need to so to my account or databases to open access to my computer? Am I using the wrong port (3306 is the default port)? Or is it something else?
Please and thanks,
Darkpunk
And sometimes this one:Can't connect to MySQL server on 'darkjournal.co.cc' (111)
Error 110 is a timeout error, and 111 is a connection refused error... So i know it probably is not my code, but just in case:Can't connect to MySQL server on 'darkjournal.co.cc' (110)
Code:
#include <iostream>
#include <string>
#include <stdlib.h>
#include "mysql/mysql.h"
using namespace std;
MYSQL *connection, mysql;
MYSQL_RES *result;
MYSQL_ROW row;
int query_state;
int login()
{
string usr;
string pass;
cout << "Username:";
cin >> usr;
cout << "Password:";
cin >> pass;
return 0;
}
int main()
{
int garbage;
cout << " _ _ _ _ \n";
cout << "( ) ( ) ( ) ( ) \n";
cout << "| |/'/' _ _ _ _ _| |/'/' _ ___ \n";
cout << "| , < /'_`\\ ( '_`\\ ( ) ( ) , < /'_`\\ /' _ `\\\n";
cout << "| |\\`\\ ( (_) )| (_) )| (_) | |\\`\\ ( (_) )| ( ) |\n";
cout << "(_) (_)`\\___/'| ,__/'`\\__, |_) (_)`\\___/'(_) (_)\n";
cout << " | | ( )_| | \n";
cout << " (_) `\\___/' \n";
cout << "________________________________________________\n\n";
cout << "Initating mySQL...\n";
mysql_init(&mysql);
cout << "Connecting to Database....\n";
connection = mysql_real_connect(&mysql,"darkjournal.co.cc","username","password","darkpunk_prototype",3306,NULL,0);
if (connection == NULL) {
cout << "Failed!\n\nError::\n" << mysql_error(&mysql) << endl;
return 1;
}
else {
cout << "Connection established...\n";
login();
}
return 0;
}
Please and thanks,
Darkpunk