SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Strangest MySQL connection problem!!

    Hi,

    I have a few different web sites on a server, called
    netdive.com

    I have a few different web sites on a server, called
    server1.anoox.com

    I am able to connect to the MySQL DB that is on server1.anoox.com
    Ok
    from Php pages of netdive.com but when I try to connect to the same DB with the same MySQL Connection command from another
    Web site of netdive.com, it will not connect and will give me this Error message:
    Code MySQL:
    SELECT command denied to user 'root'@'server1.netdive.com' for table 'articles'

    What the HEK is going on? I am using the SAME EXACT MySQL Connection command!!!

    Regards,

    Anoox search engine volunteer

    www.anoox.com

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,070
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    The problem probably lies in the permissions the server has.

    Each database and each table can have each own permissions set, using the GRANT statement.
    Now, what is usally done is something like this

    GRANT ALL PERMISSIONS ON some_database TO some_user@localhost ... (etc, not relevant)

    The problem lies in the @localhost part.
    When you connect from the code running on netdive.com to the DB on netdive.com, you are connecting from the server to itself, using localhost, so the grant is accepted, but when you connect from server1.anoox.com you're not connecting from localhost, and therefore don't have the permissions connections from localhost have.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,019
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Do both PHP and MySQL reside on the same server?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  4. #4
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    This cannot be the problem, since again I am able to connect from netdive.com server to MySQL on server1.anoox.com from Php pages that are loading from netdive.com web site, however I am not able to connect to MySQL on server1.anoox.com from Php pages that is on another web site that is on the same server that also hosts netdive.com

    Quote Originally Posted by ScallioXTX View Post
    The problem probably lies in the permissions the server has.

    Each database and each table can have each own permissions set, using the GRANT statement.
    Now, what is usally done is something like this

    GRANT ALL PERMISSIONS ON some_database TO some_user@localhost ... (etc, not relevant)

    The problem lies in the @localhost part.
    When you connect from the code running on netdive.com to the DB on netdive.com, you are connecting from the server to itself, using localhost, so the grant is accepted, but when you connect from server1.anoox.com you're not connecting from localhost, and therefore don't have the permissions connections from localhost have.

    Anoox search engine volunteer

    www.anoox.com

  5. #5
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    We have many different servers.
    2 of these servers are the ones that I mentioned.
    Both these servers host many different web sites.
    Both these servers have Php and MySQL DBs on them.
    So I am able to connect from xyz.com that is on x1 server to the MySQL that is on s2 server.
    However strangely I am not able to connect from yyy.com that is on x1 server to the MySQL that is on s2 server.

    Quote Originally Posted by SpacePhoenix View Post
    Do both PHP and MySQL reside on the same server?

    Anoox search engine volunteer

    www.anoox.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •