How to fix "Not Connecting to MYSQL" error in WAMP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Brad Laine
    New Member
    • Jan 2011
    • 2

    How to fix "Not Connecting to MYSQL" error in WAMP?

    Hello,
    I am getting the error "Warning: mysql_connect() [function.mysql-connect]: php_network_get addresses: getaddrinfo failed: No such host is known. in C:\wamp\www\jle arning\index.ph p on line 78"

    My connection script is
    Code:
    $hostname = "localhost";
            $dbuser = "root";
            $dbpassword = "xxxxxxxx";
            $base = "image";
            $link = mysql_connect('hostname','dbuser','dbpassword'); 
            mysql_select_db("$base", $link);
    I do have the password set up, but root is the only name I know. Root plus the password is what I use to sign into phpmyadmin with. Will be happy to provide any other info requested.

    My user looks like this
    root 127.0.0.1 global ALL PRIVILEGES Yes Edit Privileges
    root localhost global ALL PRIVILEGES Yes Edit Privileges

    My MYSQL server shows traffic whenever I reload the page in question

    Could this have anything to do with typeing "Use mysql" in the console when I set up the password? Should I be using something else?

    I have resolved this issue.Thank you for reading
    Last edited by Brad Laine; Jan 31 '11, 07:30 PM. Reason: Adding data. Added Issue Resolved
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    Care to elaborate on how you solved your issue so others with similar problems may benefit in the future?

    Comment

    • Brad Laine
      New Member
      • Jan 2011
      • 2

      #3
      I hate to say it, but I removed the variables from the connection script, put the user name, password and localhost where the variables were and bingo, I was connected. I went over and over the variables and can find no fault with them, so I am at a total loss as to why it would not connect.

      Comment

      • Giovanni Moreno
        New Member
        • Aug 2011
        • 1

        #4
        you should use double quotes inside mysql_connect

        Comment

        Working...