1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Wrong database being used... can't figure this out!

Discussion in 'MySQL' started by mistermix, Dec 1, 2010.

  1. #1
    I've got a mysql database problem that is driving me nuts.

    I have one site working fine and calling its own mysql database:

    // Database Information
    // MySQL Host (usually localhost)
    $mysql_host = "localhost";
    // MySQL Database Name
    $database_name = "play77_play";
    // MySQL User Name
    $database_user = "play77_play7";
    // MySQL User Password
    $user_password = "*******";
    Code (markup):
    I'm now trying to install a 2nd site on the same cpanel account. Using a different database:

    // Database Information
    // MySQL Host (usually localhost)
    $mysql_host = "localhost";
    // MySQL Database Name
    $database_name = "play77_fishy";
    // MySQL User Name
    $database_user = "play77_fishy";
    // MySQL User Password
    $user_password = "*******";
    Code (markup):
    The only problem is that no matter what I try, the 2nd site keeps calling up content from the 1st database. The only time the 2nd site works correctly is if I delete the 1st database. It then loads the 2nd database content fine.

    I find this strange considering each database is under a different mysql user, with a different password.

    I have multiple sites installed on the server using the same script (under different cpanel accounts). They all work fine.

    What else can I try to fix this?

    thanks
     
    mistermix, Dec 1, 2010 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    You can remove all grants for the second user on first database to assure it cannot even read from there.

    Regards :)
     
    koko5, Dec 2, 2010 IP
  3. mistermix

    mistermix Active Member

    Messages:
    2,326
    Likes Received:
    85
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Well, last night I thought i had it fixed. I even installed a 3rd site and all were working fine.

    BUT today i checked the sites and all 3 are loading content from the 1st database again...

    All 3 user accounts are separate and don't have permissions on the other databases.

    Do you fancy logging in to cpanel and having a look?
     
    mistermix, Dec 2, 2010 IP
  4. mistermix

    mistermix Active Member

    Messages:
    2,326
    Likes Received:
    85
    Best Answers:
    0
    Trophy Points:
    90
    #4
    I've narrowed the problem down slightly. The 2 extra sites are located in sub directories of the main site and they are somehow using the config.php of the first site.

    So they are calling the wrong config.php file that contains the database details of the 1st site.
     
    mistermix, Dec 2, 2010 IP
  5. iama_gamer

    iama_gamer Active Member

    Messages:
    404
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    just check the flow of the program. I suggest putting it in a seperate file first and then see if any other files are included between the file being used and the file that contains the config
     
    iama_gamer, Dec 4, 2010 IP