MySQL error -
aCloudy - 30.04.2015
Hello guys.
When I run samp-server.exe
I see this error:
Код:
[MySQL] Error <0>: Failed to connect. Can't connect to MySQL server on 'mysql1.000webhost.com' <10060>
Here is the OnGameModeInit:
Код:
new MySQL:connect;
public OnGameModeInit()
{
connection = mysql_init(LOG_ONLY_ERRORS, 1);
mysql_connect(mysql_host, mysql_user, mysql_password, mysql_database, connection, 1);
if(connection) //checks if the database is successfully connected
{
new dest[200];
mysql_stat(dest); // display the mysql database statistics.
printf(dest);
printf(">> MySQL connection successfully initialized"); // if it is connected it will display this line, if not then it wont display anything.
}
SetGameModeText("Team Deathmatch");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
Help!
Re: MySQL error -
TommyB - 30.04.2015
You should give this a read and see if it helps you out any.
http://forums.mysql.com/read.php?34,49742,239961
Re: MySQL error -
aCloudy - 30.04.2015
Quote:
Originally Posted by TommyB
|
No, This did not help me.
Can you simply explain me what to do ?
Re: MySQL error -
bgedition - 30.04.2015
May be something is wrong with your defines for the connection. Check it again
there is simply example that i'm using: (mysql version R39-3)
pawn Код:
new mysql_handle;
mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG); //if you want to log only errors remove | LOG_WARNING | LOG_DEBUG
mysql_handle = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
if(mysql_errno(mysql_handle) != 0) {
print("[ERROR]: Could not connect to database!");
} else {
print("[DEBUG]: Connected to database!");
}
Re: MySQL error -
Sgt.TheDarkness - 30.04.2015
Replace "mysql1.000webhost.com" with the IP address instead.
Also, attempting to run a MySQL connection to a remote host for a SA-MP server can be both laggy and very insecure, I highly suggest you switch things around.
Re: MySQL error -
aCloudy - 30.04.2015
Quote:
Originally Posted by Sgt.TheDarkness
Replace "mysql1.000webhost.com" with the IP address instead.
Also, attempting to run a MySQL connection to a remote host for a SA-MP server can be both laggy and very insecure, I highly suggest you switch things around.
|
How to get the IP address of the "mysql1.000webhost.com" ?
-----------------------------------------------------
Edition:
Quote:
Originally Posted by bgedition
May be something is wrong with your defines for the connection. Check it again
there is simply example that i'm using: (mysql version R39-3)
pawn Код:
new mysql_handle; mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG); //if you want to log only errors remove | LOG_WARNING | LOG_DEBUG mysql_handle = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password); if(mysql_errno(mysql_handle) != 0) { print("[ERROR]: Could not connect to database!"); } else { print("[DEBUG]: Connected to database!"); }
|
I did this and got one error and warning:
Код:
C:\Program Files\lvcnrr\gamemodes\SQL.pwn(59) : error 017: undefined symbol "mysql_log"
C:\Program Files\lvcnrr\gamemodes\SQL.pwn(61) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: MySQL error -
bgedition - 30.04.2015
@aCloudy As I'm seeing you are using 000webhost.com and you CAN'T use remote connection because its free account
Re: MySQL error -
Sgt.TheDarkness - 30.04.2015
Quote:
Originally Posted by aCloudy
How to get the IP address of the "mysql1.000webhost.com" ?
|
Resolve it?..
Код:
C:\Users\TheDarkness>ping mysql1.000webhost.com
Pinging mysql1.000webhost.com [10.1.1.101] with 32 bytes of data:
Control-C
^C
C:\Users\TheDarkness>
The IP address is 10.1.1.101
Re: MySQL error -
aCloudy - 30.04.2015
Quote:
Originally Posted by bgedition
@aCloudy As I'm seeing you are using 000webhost.com and you CAN'T use remote connection because its free account
|
Which host should I do ?
Re: MySQL error -
Sgt.TheDarkness - 30.04.2015
Quote:
Originally Posted by bgedition
@aCloudy As I'm seeing you are using 000webhost.com and you CAN'T use remote connection because its free account
|
I'm not entirely sure if this is true, but I've not looked at 000webhost ever since I got smart.
Quote:
Originally Posted by aCloudy
Which host should I do ?
|
If you're going to host a server, I suggest that you purchase a VPS, or go to a sa-mp server hosting website and buy hosting from them.
As for home hosting, installing XAMPP should be easy enough for you to set up a MySQL database connection for the SA-MP server.