Mysql Username And Password problem

Discussion in 'Programming' started by aguswgs, May 2, 2011.

  1. #1
    Hello..
    In the following code i would like to know what i am supposed to type as my username and password ? Or how can i set that values?

    ?php
    $con = mysql_connect("localhost","username","password");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }


    ?>
     
    aguswgs, May 2, 2011 IP
  2. om39a

    om39a Peon

    Messages:
    287
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $localhost = Instance of your DB (Ex: example.com:3307)
    $username = your user name for mysql
    $password = your password for mysql

    $con = mysql_connect($localhost,$username,$password);

    I suppose this is what you are asking for
     
    om39a, May 2, 2011 IP
  3. aguswgs

    aguswgs Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    this really working.. thanks for info
     
    aguswgs, May 2, 2011 IP
  4. finna

    finna Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    username and password can be setup in your MySQL server..
     
    finna, May 4, 2011 IP
  5. m0nster

    m0nster Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    mysql_connect("localhost", "username", "password");

    replace "username" and "password" with the username and password for ur SQL DB
     
    m0nster, Jun 2, 2011 IP