Couldn't establish a MySQL connection
#1

Aye

I am getting this error while running my server:
Код:
Connection::Connection - establishing connection to MySQL database failed: #2003 'Can't connect to MySQL server on host (xx.xx.xx.xx) (111)
Pawn code:
PHP код:
    new MySQLOptoption_id mysql_init_options();
    
mysql_set_option(option_idAUTO_RECONNECTtrue);
    
SQL mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_PASSWORDMYSQL_DATABASEoption_id);
    if (
SQL == MYSQL_INVALID_HANDLE || mysql_errno(SQL) != 0)
    {
        print(
"MySQL connection failed. Server is shutting down.");
        
SendRconCommand("exit");
        return 
1;
    } 
The parameters must be correct since I am able to log with these through phpMyAdmin. What could be the issue?
Might it be the fact im using a static Debian MySQL version?
Reply
#2

Quote:
Originally Posted by ranme15
Посмотреть сообщение
Might it be the fact im using a static Debian MySQL version?
That doesn't affect your connection at all. However I'd like to know what's the host define you are using, is it localhost?
Reply
#3

Quote:
Originally Posted by iKarim
Посмотреть сообщение
That doesn't affect your connection at all. However I'd like to know what's the host define you are using, is it localhost?
It is the IP address of my host.
Reply
#4

Are you hosting SA-MP server on the same server which has the mysql server? If so, try connecting to localhost. Otherwise, allow remote connections to your mysql server and then give it a shot.
Reply
#5

Quote:
Originally Posted by Lvcnr
Посмотреть сообщение
Are you hosting SA-MP server on the same server which has the mysql server? If so, try connecting to localhost. Otherwise, allow remote connections to your mysql server and then give it a shot.
I gave 'localhost' a try after the first comment and it actually works. Thanks for your replies!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)