Results 1 to 9 of 9

Thread: Simple PHP/MySQL ?

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Simple PHP/MySQL ?

    I'm just starting with MySQL. I created a database and a table, then found an example script to use with the table, however I don't know what to put for the host?

    PHP Code:
    mysql_connect(???, root); 
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    localhost...I've only had to use an server name once.

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I tried that at first (that's what the example had) but then I got a whole mass of errors:

    Warning: Access denied for user: 'root@localhost' (Using password: NO) in /home/vbshelf/public_html/test.php on line 13
    Do I need a password or something?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I got it to connect, but now I have a few more errors to work with.

    I had to change root to vbshelf_root.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    PHP Code:
    mysql_connect(???, root); 
    well, my ROOT password doesnt have a password, and i use this to connect:
    PHP Code:
    mysql_connect(LOCALHOST, root); 
    , i'm not sure about abbreviations and stuff, i cant check @ the moment cos i'v just got a new pc and cant get my other HDD running on it yet, it has my whole page on it and every PHP script i have

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    you should never leave root having no password, for obvious reasons.

    This should work fine
    PHP Code:
    // initialise database variable
    $db mysql_connect("localhost""username""password"); 

  7. #7

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by The Hobo
    I got it to connect, but now I have a few more errors to work with.

    I had to change root to vbshelf_root.
    Yeah, I'm past that, thanks.

    I guess my server requires the domain to be put before everything. So if the user is 'root', it requires 'vbshelf_root' and if the data base is 'bing', it requires 'vbshelf_bing.'

    Thanks for the help.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by chrisjk
    you should never leave root having no password, for obvious reasons.
    How do I set the password for root?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  9. #9
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    well, i'd reccomend downloading the MySQL_GUI it is soo handy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width