MySqL Connection Error
#1



here the codes:


Quote:

#define SQL_HOST "localhost"
#define SQL_USER "root"
#define SQL_PASS ""
#define SQL_DATA "localhost"

Quote:

public OnGameModeInit()
{
ConnectToDatabase();
}

Quote:

forward ConnectToDatabase();
public ConnectToDatabase()
{
printf("[ConnectToMainPipeline:] Connecting to %s...", SQL_DATA);
mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
MySQLPipeline = mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS, 3306, true, 2);
if(mysql_errno(MySQLPipeline) != 0)
{
printf("[MySQL] (MySQLPipeline) Fatal Error! Could not connect to MySQL: Host %s - DB: %s - User: %s", SQL_HOST, SQL_DATA, SQL_USER);
print("[MySQL] Note: Make sure that you have provided the correct connection credentials.");
printf("[MySQL] Error number: %d", mysql_errno(MySQLPipeline));
}
return 1;
}

OR


Quote:

stock ConnectToDatabase()
{
printf("[ConnectToMainPipeline:] Connecting to %s...", SQL_DATA);
mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);

MySQLPipeline = mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS, 3306, true, 2);
if(mysql_errno(MySQLPipeline) != 0)
{
printf("[MySQL] (MySQLPipeline) Fatal Error! Could not connect to MySQL: Host %s - DB: %s - User: %s", SQL_HOST, SQL_DATA, SQL_USER);
print("[MySQL] Note: Make sure that you have provided the correct connection credentials.");
printf("[MySQL] Error number: %d", mysql_errno(MySQLPipeline));
}
return 1;
}

Please Help ,can't connect in localhost or any mysql host,also server compiles sucessfully.
Changed MYSQL plugins/includes dosent work..
Reply
#2

Database 'localhost' does not exist.

Next time, ****** the error code.
Reply
#3

Quote:
Originally Posted by introzen
Посмотреть сообщение
Database 'localhost' does not exist.

Next time, ****** the error code.
so ok,we're going to delete the database,but it's saying "could not connect to localhost" how can i fix that?
I mean my server dosent contact to mysql even in localhost..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)