View Full Version : Can somone help me decipher an error with php and mySql?

Single Paradox
06-28-2005, 04:27 AM
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:


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



It was just testing so Judge and Bingo really aren't going to be username and password. Just testing though.

06-28-2005, 04:32 AM
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.

Single Paradox
06-28-2005, 04:34 AM
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
06-28-2005, 04:36 AM
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.

06-28-2005, 04:38 AM
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?

Single Paradox
06-28-2005, 04:41 AM
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
06-28-2005, 04:44 AM
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.

06-28-2005, 04:44 AM
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.

Single Paradox
06-28-2005, 04:48 AM
I can't find the bin folder or the file you specified... This is what my MySql folder looks like:


06-28-2005, 05:31 AM
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:


Single Paradox
06-28-2005, 09:01 AM
Ok, thanks a lot nightfire!! my mysql folder now looks like this:


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.

06-28-2005, 02:38 PM
Go to the bin folder and double click on the file named mysql. That should then run mysql for you.

Single Paradox
06-28-2005, 09:59 PM
Thank you very much for the help, but when I clicked on MySql.exe, this error appeared on the Command Prompt


Single Paradox
06-30-2005, 02:22 AM
Ok, I figured out how to install the mysql folder, but when I say NET START mysql in the command prompt, this comes up:


Single Paradox
06-30-2005, 02:35 AM
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.

06-30-2005, 03:08 AM
On an XP OS with the database instaled to a NTFS partition
you'll get the error
The MySql service is starting.
The MySql service could not be started.

A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.
To resolve the problem give full access permisions to the user SYSTEM on the directory where database it's installed

Single Paradox
06-30-2005, 03:12 AM
I'm sorry I don't understand. Give full permission to the user Judge? Then it will work?

06-30-2005, 03:50 AM
XP needs permission to access the database, so you need to change permissions for SYSTEM to access it

Single Paradox
06-30-2005, 04:13 AM
so would it be like:

grant all privileges on *.* to SYSTEM


06-30-2005, 04:36 AM
Ignore what I said lol

I think I remember it being something about one of the mysql config files. See if you have a file that's called something like mysqladmin this should set up mysql correctly if I remember right

Single Paradox
06-30-2005, 04:55 AM
Thank you for all your help, but nothing seems to be working -.-

Single Paradox
06-30-2005, 04:58 AM
I clicked on the mysqladmin setting

I still can't NET START mysql