Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can somone help me decipher an error with php and mySql?

    This is an error I got from trying to connect to mySql:

    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/html/phptest.php on line 138


    This is my PHP code:

    PHP Code:

    <?php 

    $conn 
    mysql_connect("localhost","Judge","Bingo");
    if(
    $conn){
    $msg="Connected saftely to mysql Judge";}

    echo(
    $msg)

    ?>
    It was just testing so Judge and Bingo really aren't going to be username and password. Just testing though.
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    What do you have set as your socket for mysql.default_host in your php.ini?
    This is assuming as well that the mysql is located on your localhost and not an external computer.

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So I should upload mysql onto my site? I'm very sorry for the noobishness, I am brand new to php and mySql. I can write pages ok, it's just the setup that is screwy. Should I upload my php.ini file, my mySql file, or both?
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #4
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Would I give out too much information if I pasted my whole php.ini file? Because I don't know where to find it. Thanks for the speedy reply by the way.
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    no, that won't be nessessary.
    I am assuming you are testing via localhost on your pc is that correct?
    You do have a mysql client installed then?

  • #6
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I do have mySql installed on MY computor, I can't seem to find the MySQL Monitor though. That could be it. Would you recommend deleting MySQL from my computor and re-installing it?
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #7
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh and yes, I am testing localhost I believe. This is my first time with php/mySql/Apache so I probably will ask a lot of questions about what I am doing. Sorry if I seem a little slow.
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    No, its probably just not autoexecuting on your startup. I'm assuming windows here. Simply go to the location of your mySQL root folders, select the bin folder and double click your winmysqladmin.exe. If that doesn't work, you can try to run it via command line, but I'd just try reseting your computer, probably something simple.

  • #9
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I can't find the bin folder or the file you specified... This is what my MySql folder looks like:

    http://www.singleparadox.com/mySql_screenShot.gif
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #10
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Looks like you've just unzipped it to there (c:\mysql). Need to install it there, double click on setup.exe. You should then get a folder looking like this:

    http://www.biggomp.com/randomshizzle/mysql.jpg

  • #11
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, thanks a lot nightfire!! my mysql folder now looks like this:

    http://www.singleparadox.com/mySql_screenShot.gif

    Not exactly the same as yours but close enough. Now what do I do? Please level with me, I know coding ok, but when it comes to computor hard drives and all that jazz I'm not too good.
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #12
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Go to the bin folder and double click on the file named mysql. That should then run mysql for you.

  • #13
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much for the help, but when I clicked on MySql.exe, this error appeared on the Command Prompt

    http://www.singleparadox.com/mySql_screenShot.gif
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #14
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, I figured out how to install the mysql folder, but when I say NET START mysql in the command prompt, this comes up:

    http://www.singleparadox.com/mySql_screenShot.gif
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old

  • #15
    Regular Coder
    Join Date
    Feb 2005
    Posts
    525
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh and now it says "Connected saftly to Judge" because I made a database with the username Judge and the password Bingo, so it works but it still gives me the error.
    Single Paradox
    My Site (Under construction)

    Not too bad for a 15 year old


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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