100 Web Space http://forum.100webspace.com/ |
|
Warning: mysql_connect() HELP!! http://forum.100webspace.com/viewtopic.php?f=5&t=5369 |
Page 1 of 1 |
Author: | da1llustrator [ Tue Nov 28, 2006 3:35 pm ] |
Post subject: | Warning: mysql_connect() HELP!! |
Hi, I'm trying to use a php script to connect to my database, but I keep getting the following error: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/www/garpoo.100webspace.net/inc/config.inc.php on line 2117 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) btw, here is the code in my script: function db_open () { global $settings; if (!($dbconn = mysql_connect ($settings['mysql1.100ws.com:3306'], $settings['garpoo_test'], $settings['*****']))) { exit (mysql_error ()); ; } if (!mysql_select_db ($settings['garpoo_test'])) { print mysql_error (); exit (); } return $dbconn; } function db_close ($dbconn) { mysql_close ($dbconn); } Parameters for hostname, login, and password should be all correct. What do I need to do to get this working? Do I need to have a mysql.sock file? I am still very new to database management. Any help would be appreciated. Thanks a bunch! ![]() |
Author: | scragar [ Fri Dec 26, 2008 1:21 am ] |
Post subject: | |
I'm a little confused with what you are doing here, normally when storing data to a variable it's usage would be something like: Code: $settings = array(
'host'=>'mysql1.100ws.com:3306', 'username'=>'garpoo_test', 'password'=>'******' ); function db_open(){ global $settings; if(!($dbconn = mysql_connect ($settings['host'], $settings['username'], $settings['password']))){ die(mysql_error ()); } .... |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |