Jump to content


Photo

Connecting to MySQL


  • Please log in to reply
2 replies to this topic

#1 fruzzgle

fruzzgle
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationKS City :]

Posted 30 May 2006 - 01:12 AM

I'm a begginer and am taking a tutorial on it. I just started the MySQL connect. Here's my code:

<?php
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
echo "Connected to MySQL<br/>";
?>


I test it and get this-

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (46)

I have no Idea what this means?

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 30 May 2006 - 05:00 AM

It means you need to consult [a href=\"http://www.mysql.com/doc/C/a/Can_not_connect_to_server.html\" target=\"_blank\"]this refman page[/a] to see which one of the many known problems you've encountered.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 vishi83

vishi83
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 31 May 2006 - 12:41 PM

[!--fonto:Times New Roman--][span style=\"font-family:Times New Roman\"][!--/fonto--]
Before executing your php script, make sure you're able to get into the mysql prompt from the terminal.
Because you have a problem with mysql connection.
Can you tell me how you connect to the mysql ?

Thanks. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

[!--fontc--][/span][!--/fontc--]





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users