Jump to content

Cannot connect to Local SQL server


doctor-Eggman

Recommended Posts

I got a tutorial for making a comment script online. I used the .sql file attached to it to make a database. Changed all that it said but when I try to use it on the web space I get this error.

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in Sitefiles/inc_rate.php on line 12

I cannot connect to the database because: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

 

I am really bad at databases and am not sure what to do.

Link to comment
Share on other sites

When I made the database in phpmyadmin it came up with this

mySQL returned an empty result set (i.e. zero rows)

 

what does this mean. Here is the .sql file I was importing to try and get it working

CREATE TABLE `comments` (
  `commentid` int(11) NOT NULL auto_increment,
  `tutorialid` int(11) NOT NULL default '0',
  `name` text NOT NULL,
  `url` text NOT NULL,
  `comment` text NOT NULL,
  `email` text NOT NULL,
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`commentid`),
  KEY `tutorialid` (`tutorialid`)
)

 

Link to comment
Share on other sites

I inserted some data into it using the insert function of phpmyadmin. I just cant get it to show on my site.

 

Here is just what happens when I try and load it.

 

http://www.compatatron.com/testpage.php

 

It just cant find it.

 

I have a database all made and it says it is there on the server. I dont get why it wont find it, the name and password are corect as is the name of the database. Its infuriating!

Link to comment
Share on other sites

It's most likely that your database connection details are not correct for the actual database server that your account should be using.

 

Somewhere in phpmyadmin or in your web hosting control panel or in your web host's FAQ section, it should state what hostname or IP address you should use for the database server for your hosting account.

 

Slightly off topic: Is there some reason you are not going through a tutorial like this on a local development system? You would save a ton of time. Also, a lot of tutorials don't have any protection or validation logic in them and they would make it easy for a hacker to exploit a live server.

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.