Jump to content

Archived

This topic is now archived and is closed to further replies.

fruzzgle

Connecting to MySQL

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?

Share this post


Link to post
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.

Share this post


Link to post
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--]

Share this post


Link to post
Share on other sites

×

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.