doctor-Eggman Posted March 22, 2010 Share Posted March 22, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/196134-cannot-connect-to-local-sql-server/ Share on other sites More sharing options...
doctor-Eggman Posted March 22, 2010 Author Share Posted March 22, 2010 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`) ) Quote Link to comment https://forums.phpfreaks.com/topic/196134-cannot-connect-to-local-sql-server/#findComment-1030110 Share on other sites More sharing options...
doctor-Eggman Posted March 23, 2010 Author Share Posted March 23, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/196134-cannot-connect-to-local-sql-server/#findComment-1030532 Share on other sites More sharing options...
fenway Posted March 23, 2010 Share Posted March 23, 2010 You've asked 3 completely unrelated questions in the same topic. Prove that you can actually connect to the DB outside of php. Quote Link to comment https://forums.phpfreaks.com/topic/196134-cannot-connect-to-local-sql-server/#findComment-1030546 Share on other sites More sharing options...
doctor-Eggman Posted March 23, 2010 Author Share Posted March 23, 2010 How do you want me to prove that? I Made the database. Followed a tutorial and no i am all stuck. I barely have any idea what I am doing. Quote Link to comment https://forums.phpfreaks.com/topic/196134-cannot-connect-to-local-sql-server/#findComment-1030587 Share on other sites More sharing options...
PFMaBiSmAd Posted March 23, 2010 Share Posted March 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/196134-cannot-connect-to-local-sql-server/#findComment-1030597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.