#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Mexico DF Mexico
    Posts
    16
    Rep Power
    0
    Thnx for taking the time to read this post.

    Well I running mi computer like a server to make my own test... I have installed PHP, Apache server and MySql Im trying to interface PHP with my sql but where do I get the following info? is there a common value that I can use??

    $hostname = "devshed";
    $username = "myusername";
    $password = "mypassword";
    $dbName = "mydbname";

    Remember Im not working directly in the server Im using mi PC like a server but still I have dynamic IP's.... and no own domain...

    Thanx
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    If MySQL resides on the same computer as the web server, than all you need for host is "localhost" and that's true for any machine.

    As for username, password and database, they are whatever you have set up in mysql. Read the mysql manual to learn how to grant permissions (set up users) and how to create a database.
  4. #3
  5. No Profile Picture
    Guest
    Devshed Newbie (0 - 499 posts)
    [QUOTE]Originally posted by ltena:
    [B]Thnx for taking the time to read this post.

    Well I running mi computer like a server to make my own test... I have installed PHP, Apache server and MySql Im trying to interface PHP with my sql but where do I get the following info? is there a common value that I can use??

    $hostname = "devshed";
    $username = "myusername";
    $password = "mypassword";
    $dbName = "mydbname";

    Remember Im not working directly in the server Im using mi PC like a server but still I have dynamic IP's.... and no own domain...
    --
    Ditto!

    This is an example that I use for my Postgres database - it illustrates the use of localhost. I used a similar layout when I ran mySql..

    Regds, Peter

    $db = pg_Connect("localhost", "","","","shopping");
    $sql = "BEGIN; INSERT INTO stuff VALUES('$what','$who','$urgent'); COMMIT";
    $result_set = pg_Exec( $db, $sql );

  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Englewood, CO
    Posts
    30
    Rep Power
    15
    yes, use localhost for the server name, but you will have to set up GRANT privileges on MySQL and then CREATE DATABASE to set/know the user id, user password and database name. I believe the default GRANT settings for MySQL is that user root (NO PASSWORD!!!!) can do ANYTHING. Therefore, you must set root's password as soon as possible. Then, you'll need to set up your database, then create GRANT privileges for specific users. All this is documented at www.mysql.com

    -TM

Similar Threads

  1. Replies: 0
    Last Post: February 11th, 2004, 07:48 AM
  2. PHP and sql
    By absinthe24 in forum PHP Development
    Replies: 3
    Last Post: February 5th, 2004, 11:03 PM
  3. Replies: 5
    Last Post: February 3rd, 2004, 01:59 PM
  4. Help using a database and php to update a scores page.
    By deathsythe in forum PHP Development
    Replies: 0
    Last Post: February 2nd, 2004, 02:48 PM

IMN logo majestic logo threadwatch logo seochat tools logo