SA-MP Forums Archive
Linux MySql problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Linux MySql problem (/showthread.php?tid=367966)



Linux MySql problem - cas126 - 11.08.2012

i have a server on linux and i am using mysql plugin. I have a localhost MYSQL database and i dont know how to use this database on the linux server. it says Function: mysql_query called when not connected to any database. Can't connect to MySQL server on '127.0.0.1' (111).

Please Help


Re: Linux MySql problem - nGen.SoNNy - 11.08.2012

mysql server is started?


Re: Linux MySql problem - cas126 - 11.08.2012

Quote:
Originally Posted by Anonym2009
Посмотреть сообщение
mysql server is started?
yeah.


Re: Linux MySql problem - nGen.SoNNy - 11.08.2012

Try to use this in your gamemode!

pawn Код:
#define mysql_host              "localhost"
#define mysql_user              "change"
#define mysql_password          "change"
#define mysql_database          "change"

ConnectMySQL()
{
    mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
    if(mysql_ping() == 1)
    {
        mysql_debug(0); // Turn this shit off
        printf("[MYSQL]: Connection to `%s` succesful!",mysql_database);
    }
    else
    {
      printf("[MYSQL]: [ERROR]: Connection to `%s` failed!",mysql_database);
    }
    return ( 1 );
}
public OnGameModeInit()
{
ConnectMySQL();
return ( 1 );
}



Re: Linux MySql problem - cas126 - 12.08.2012

tried and still the same problem.
maybe it is because i have a Dedicated server?


Re: Linux MySql problem - VOXrr - 12.08.2012

Quote:
Originally Posted by cas126
Посмотреть сообщение
tried and still the same problem.
maybe it is because i have a Dedicated server?
Are you managing your dedicated server yourself?
If so, are you sure the database has actually been created?

If it's of any use to you, I have created a tutorial to quickly get a web server up and running, including the latest version of MySQL and PhpMyAdmin.
That should help you manage your databases easier if you're having difficulties.


Re: Linux MySql problem - cas126 - 12.08.2012

Quote:
Originally Posted by VOXrr
Посмотреть сообщение
Are you managing your dedicated server yourself?
If so, are you sure the database has actually been created?

If it's of any use to you, I have created a tutorial to quickly get a web server up and running, including the latest version of MySQL and PhpMyAdmin.
That should help you manage your databases easier if you're having difficulties.
no i am not managing the server so maybe this is the problem. i have created the database on my computer.


Re: Linux MySql problem - VOXrr - 12.08.2012

Quote:
Originally Posted by cas126
Посмотреть сообщение
no i am not managing the server so maybe this is the problem. i have created the database on my computer.
Hang on, are you trying to set your dedicated server to connect to a database hosted on your home computer?


Re: Linux MySql problem - Alex Valdez - 12.08.2012

Quote:
Originally Posted by VOXrr
Посмотреть сообщение
Hang on, are you trying to set your dedicated server to connect to a database hosted on your home computer?
If what he is saying is true, you'll have to port foward this port:
3306

That port is for the MySQL server, this port allows your computer and the dedicated server communicate correctly.

But it is not also recommended to have separate servers contacting each other because it will not respond quickly as it should.


Re: Linux MySql problem - VOXrr - 12.08.2012

If you're unable to install MySQL on your server, then yes, using files would be significantly faster than an offsite MySQL server hosted on your home computer.