Need help ASAP - MySQL Connect Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tknd2680
Forum Newbie
Posts: 1
Joined: Tue Jul 12, 2005 2:45 pm
Location: maryland

Need help ASAP - MySQL Connect Error

Post by tknd2680 »

THIS IS THE ERROR I'M GETTING, CAN ANYONE TELL ME WHAT THE PROBLEM IS

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) in /mnt/htdocs/.phpfuncs on line 2

Warning: mysql_select_db(): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) in /mnt/htdocs/.phpfuncs on line 3

Warning: mysql_select_db(): A link to the server could not be established in /mnt/htdocs/.phpfuncs on line 3
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Restart your MySQL server ;)

If that's not where mysql.sock is actually stored then include the path to mysql.sock in the mysql_connect() function as per the manual.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Ya, restart your server. I had this problem yesterday and that fixed it. If that doesn't fix it, however, try goofing with your my.cnf file.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply