MySQL question
#1

If i connect to the database and the xampp/wampp is closed wouldn't it prevent the connection? Cause for me it's say that the connection went succesfully and I'm really confused, cause if xampp/wampp is closed, how is it possible to connect in the first place?
Reply
#2

The questions are: which MySQL plugin do you use, and what is your code for checking the connection is successful? Some plugins return 1 for a successful connection, others return 0, so you might want to double-check that.
Also, is the returned value different depending on weither your WAMP server is on or off?
Reply
#3

IIRC MySQL installed by xamp/wamp is a windows service set to run automatically. You have to shut it down manually from Services.
Reply
#4

So basically if this program runs into my computer, it won't matter wether or not I have the xampp/wampp closed, because of that program it reads it like it's open, right?
Reply
#5

The code is this:
pawn Код:
Connect_to_MySQL()
{
    DbHandle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
    if( DbHandle )
        return 1;
    return 0;
}


//Into OnGameModeInit
    // Database
    if(Connect_to_MySQL() == 1)
    {
        print("[MySQL Console] MySQL connection succesfully established!");
    }
    else
    {
        print("[MySQL Console] MySQL connection has failed! Please check your database for more information!");
        SendRconCommand("exit");
    }
Reply
#6

Okay, can you now tell us if it makes any difference when the server is started? If it tells you "connection has failed", then you need to change "if( DbHandle )" to "if( !DbHandle )" in the 3rd line you posted.
Reply
#7

If i do that then I asumme it will close even if it works.
The fact is: I tried and changed the database, it seems it won't work if I change any of that database info, so what Misiur is right, it connects even if the service itself it's closed because it's there some plugin installed within my computer I assume. Thanks for all rep for both of you.
Reply
#8

Thank you! In case you want to actually stop the service, here is how to do it:
- Hold Windows key and press R on your keyboard, this should open the "run" dialog
- Inside the dialog, type "services.msc" without the quotes
- Scroll down until you find "MySQL server" or something similar
- Click on that line, then click the "stop" link on the left - done
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)