SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    !Connecting to MySql

    I have a file only containging the following code:

    PHP Code:
    <?
    $dbcnx 
    = @mysql_connect("localhost""root""bmcadmin");
    if (!
    $dbcnx) {
      echo( 
    "<P>Unable to connect to the " .
            
    "database server at this time.</P>" );
      exit();
    }else{
      echo( 
    "Success!!" );
    }
    ?>
    Every time I run it, it fails. Is there a way that I can find out a more specific reason why it will not connect? Thanks.
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, is the mysql server actually running; ie, have you started it? Is this on a home PC or remote server (shared?)? Is this running on Windoze or linux?

    If you are sure that the mysql server is running, then what is the port it is listening on? The default is 3306.

  3. #3
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a machine that is running Red Hat... I'm on the actual machine. The MySQL daemon is up and running. I'm not sure what port exactly it is listening on, but when I do a 'netstat -l' MySQL is listening on its port...
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry that I don't have enough knowledge about configerations to be of much help. However, may I suggest you turn error reporting on by removing the @ before @mysql_connect and you might receive a more meaningful error message in the browser.

    Also, in your php.ini file there should be a whole section of settings for mysql. Things such as

    mysql.default_port = 3306
    mysql.default_socket = /tmp/mysql.sock

    To be honest, I installed apache+php+mysql+webmin+phpMyAdmin from the Nusphere bundle on my local Redhat 7 linux system. I just dl it from www.nusphere.com, untared it, opened up the install.html file, clicked on install and bingo! everything up and running.
    Last edited by freakysid; Jun 13, 2001 at 04:55.

  5. #5
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Duh! *Slaps himself in the forhead* That is just so obvious. Thanx man...
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"


Bookmarks

Posting Permissions

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