Jump to content

Connecting to MySQL


fruzzgle

Recommended Posts

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

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

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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

[!--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--]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.