mysql_connect problem ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dude

    mysql_connect problem ...

    this is the code:

    $user = "user";
    $pass = "";
    $connect = mysql_connect(' localhost',$use r,$pass);
    or die('could not connect: '. mysql_error());

    mysql_close($co nnect);

    i'm a beginer, and i just want to see if i could connect to server.
    on pypmyadmin i set the following for the user@localhost:

    password: No
    global privileges: all privileges
    grant: yes ...

    and ofcourse i get the warning: mysql_connect() function.mysql-connect]:
    Access denied for user 'user'@'localho st' error on the connect string line.

    it has everything, and why doesnt connect string he let me in.
    please help ...
  • Jan Thomä

    #2
    Re: mysql_connect problem ...

    On Sun, 18 Jun 2006 08:11:31 +0200 dude wrote:
    [color=blue]
    > this is the code:
    >
    > $user = "user";
    > $pass = "";
    > $connect = mysql_connect(' localhost',$use r,$pass);
    > or die('could not connect: '. mysql_error());[/color]

    Try "127.0.0.1" instead of "localhost" . This usually does the trick. Ow and
    get a real name, dude :D

    Best regards,
    Jan Thomä

    Comment

    • David Haynes

      #3
      Re: mysql_connect problem ...

      dude wrote:[color=blue]
      > this is the code:
      >
      > $user = "user";
      > $pass = "";
      > $connect = mysql_connect(' localhost',$use r,$pass);
      > or die('could not connect: '. mysql_error());
      >
      > mysql_close($co nnect);
      >
      > i'm a beginer, and i just want to see if i could connect to server.
      > on pypmyadmin i set the following for the user@localhost:
      >
      > password: No
      > global privileges: all privileges
      > grant: yes ...
      >
      > and ofcourse i get the warning: mysql_connect() function.mysql-connect]:
      > Access denied for user 'user'@'localho st' error on the connect string line.
      >
      > it has everything, and why doesnt connect string he let me in.
      > please help ...[/color]

      If you use 'localhost' mysql will often try to connect via a named-pipe
      which involves having the named pipe set up and the permissions correct.

      If you use 127.0.0.1 (i.e. the TCP/IP loopback to localhost) mysql will
      use the TCP/IP stack instead.

      Since 127.0.0.1 is well known to the TCP/IP driver, it is all resolved
      in memory so there is no real performance penalty using it vis-a-vis
      named pipes.

      -david-

      Comment

      • dude

        #4
        Re: mysql_connect problem ...

        > Try "127.0.0.1" instead of "localhost" . This usually does the trick. Ow and[color=blue]
        > get a real name, dude :D
        >
        > Best regards,
        > Jan Thomä[/color]

        hey dude, this doesn't work dude ... what a disaster dude :(
        eny more tricks i can try, dude ?
        google says allot but nothing that i can use and solve this ...

        aha, about the name, i will have to change it, its terrible :D

        Comment

        • David Haynes

          #5
          Re: mysql_connect problem ...

          dude wrote:[color=blue][color=green]
          >> Try "127.0.0.1" instead of "localhost" . This usually does the trick.
          >> Ow and
          >> get a real name, dude :D
          >> Best regards,
          >> Jan Thomä[/color]
          >
          > hey dude, this doesn't work dude ... what a disaster dude :(
          > eny more tricks i can try, dude ?
          > google says allot but nothing that i can use and solve this ...
          >
          > aha, about the name, i will have to change it, its terrible :D[/color]
          Can you connect to mysql from the command line?
          If not, then you need to work out how to create the account
          user@localhost in mysql before trying to connect to it from php.

          If this is your problem, take a look at the 'GRANT' section of mysql.

          -david-

          Comment

          • Terry

            #6
            Re: mysql_connect problem ...

            dude wrote:[color=blue]
            > this is the code:
            >
            > $user = "user";
            > $pass = "";[/color]
            define('DB_USER ','user');
            define('DB_PASS WORD','');
            define('DB_HOST ','localhost');

            Works for me, YRMV.
            --
            TK

            Still Having a Ball











            ..

            ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
            http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
            ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

            Comment

            • adlerweb

              #7
              Re: mysql_connect problem ...

              dude schrieb:[color=blue][color=green]
              >> Try "127.0.0.1" instead of "localhost" . This usually does the trick.
              >> Ow and
              >> get a real name, dude :D
              >> Best regards,
              >> Jan Thomä[/color]
              >
              > hey dude, this doesn't work dude ... what a disaster dude :(
              > eny more tricks i can try, dude ?
              > google says allot but nothing that i can use and solve this ...
              >
              > aha, about the name, i will have to change it, its terrible :D[/color]

              Have you reloaded the user-tables after adding the user? ( FLUSH
              PRIVILEGES ;)

              Florian

              Comment

              • dude

                #8
                Re: mysql_connect problem ...

                thank you ALL ... have a nice day ...

                Comment

                • Jerry Stuckle

                  #9
                  Re: mysql_connect problem ...

                  Terry wrote:[color=blue]
                  > dude wrote:
                  >[color=green]
                  >> this is the code:
                  >>
                  >> $user = "user";
                  >> $pass = "";[/color]
                  >
                  > define('DB_USER ','user');
                  > define('DB_PASS WORD','');
                  > define('DB_HOST ','localhost');
                  >
                  > Works for me, YRMV.[/color]

                  The only difference is he's using variables and you're using constants. Either
                  will work fine.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  Working...