Linux MySql problem
#1

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
Reply
#2

mysql server is started?
Reply
#3

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

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 );
}
Reply
#5

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

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.
Reply
#7

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.
Reply
#8

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?
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)