Database connection problem

Discussion in 'MySQL' started by horseflyuk, Oct 9, 2008.

  1. #1
    Hi there, im receiving this error message from my website
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'babyweaning'@'server213-171-218-188.livedns.org.uk' (using password: YES) in /home/fhlinux188/b/babyweaning.com/user/htdocs/common/common.php on line 5
    Failed database connection

    On line five of the common php it says
    if(!($dbase = mysql_connect(DBHOST,DBNAME,DBPSWD))){
    echo "Failed database connection";

    Has anyone got any ideas?

    Thank you all in advance for your help
     
    horseflyuk, Oct 9, 2008 IP
  2. rhoula

    rhoula Well-Known Member

    Messages:
    875
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    145
    #2
    Check line 4 first.
    Just wondering did you enter the host name, the username and password.
    Are you using a table in your database that you are not specifying in your script?

    I m not very good at this but i was having the same problems.
    Each time I solve one I find another one.
     
    rhoula, Oct 9, 2008 IP
  3. nirajkum

    nirajkum Active Member

    Messages:
    815
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Check the connection string parameter otherwise Code seems to be ok for me
     
    nirajkum, Oct 9, 2008 IP
  4. horseflyuk

    horseflyuk Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi guys, thank you both for your help.
    Basically we had a web guy working for us, but he has left on sour terms, i have since (last week) started trying to learn the basics. So i am at a very early stage and as such i don't have much of an idea what you mean about search string parameters.

    This is from top of the common.php to line 10

    <?php

    function connectselect(){
    ## Connects to mysql and selects database
    if(!($dbase = mysql_connect(DBHOST,DBNAME,DBPSWD))){
    echo "Failed database connection";
    exit();
    }

    In laymans terms if possible, how would i go about fixing it? Your help is much appreciated
     
    horseflyuk, Oct 10, 2008 IP
  5. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #5
    The mysql user 'babyweaning' is not allowed to connect to mysql server. Give permissions to this user to connect to database server.
     
    mwasif, Oct 10, 2008 IP