SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2000
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code I tried to test on ns.domain.dom

    <?php
    $dbcnx = mysql_connect("ip_number", "user_name", "password");

    echo ("$dbcnx");

    ?>


    The result I have
    Warning: MySQL Connection Failed: Host 'ns' is not allowed to connect to this MySQL server in /path_to_the_file/database_test3.php on line 3


    What is wrong? Thank you

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try

    $dbcnx = mysql_connect("localhost", "user_name", "password");

    unless your host tells you otherwise 'localhost' as the host should do the job.

  3. #3
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try changing the IP address to localhost - I assume the script is running on the same server as MySQL?

    If not you will need to tell MySQL to accept connections from that user from remote locations.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2000
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Once I made the change you mentioned, I've got a soccet connection error which says;

    Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /path_to_the_file/database_test3.php on line 3


    thank you

  5. #5
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So this is another problem!
    You could do a search on this problem as I had the same problem not very long ago and there is a thread of my problem.
    Or if you run your own server, then there is also a thread about this in Server Support Forum.

    Good luck!
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  6. #6
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warning: MySQL Connection Failed: Host 'ns' is not allowed to connect to this MySQL server in /path_to_the_file/database_test3.php on line 3

    as said before, this is due to security settings on mySQL which do not allow remote connections to the database, so you would have to connect to 'localhost' ..

    Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /path_to_the_file/database_test3.php on line 3

    that generally means that the mySQL server is not running

    hope that helps

    ---------------
    SitePoint Community Moderator
    myPHPhost.com

  7. #7
    SitePoint Enthusiast
    Join Date
    Dec 2000
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My hosting company 's response is as follows, could anybody explain me what it means? What does it mean I have two versions? I installed mysql only once.

    Also, how do I make sure it's not going to happen again?

    thank you

    my hosting company's response about the problem;

    You have two versions of the MySQL software on your server, the one in /usr/.../... and an RPM. This should not matter unless by chance they both run at the same time. The RPM will not start if the other is already running, but I'm not so sure about the other way around. 8)


  8. #8
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IF you use a version of mySQL which you compiiled yourself, then connect to the server as super user, and type:

    rpm -e mysql

    that will remove the RPM install of mysql, and then it wont start anymore .. so the version you compiled in will start

    IF you did not compile mySQL in the first place, then i advise to contact somebody who did compile it or somebody who is competant regarding unix system and their working

    ---------------------
    SitePoint Community Advisor
    Kryogen Technologies: we KNOW what we're doing, do you?


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
  •