chamtech Posted April 3, 2008 Posted April 3, 2008 Anyone knows why I am getting this message when conneting to the site: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/c/h/a/chamtech/html/includes/functions/database.php on line 19 Unable to connect to database server! database.php (line 19) if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } Thanks
chamtech Posted April 3, 2008 Author Posted April 3, 2008 Anyone knows why I am getting this message when conneting to the site: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/c/h/a/chamtech/html/includes/functions/database.php on line 19 Unable to connect to database server! database.php (line 19) if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } Thanks Here is the link to the website which causing this error message: My Website Thanks again
arietis Posted April 3, 2008 Posted April 3, 2008 Here is the link to the website which causing this error message: My Website Thanks again my guess is that in your includes/configure.php file, the define('DB_SERVER', '...'); is not set to the right value. this should have the name of the machine where the mysql server is running. double check that it is correct by using your ips's control panel.
chamtech Posted April 4, 2008 Author Posted April 4, 2008 my guess is that in your includes/configure.php file, the define('DB_SERVER', '...'); is not set to the right value. this should have the name of the machine where the mysql server is running. double check that it is correct by using your ips's control panel. This is what I have in it. define('DB_SERVER', ''); // eg, localhost - should not be empty for productive servers How do I check that using my ip's control panel? Thanks
Guest Posted April 4, 2008 Posted April 4, 2008 The bottom of your configure.php file should be define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers define('DB_SERVER_USERNAME', 'database_username'); define('DB_SERVER_PASSWORD', 'password'); define('DB_DATABASE', 'database_name'); define('USE_PCONNECT', 'false'); // use persistent connections? define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql' The bold parts are the sections you need to include. They can be found via your hosts control panel. Click on the Data Base icon and you should find the values to put in these parts.
arietis Posted April 4, 2008 Posted April 4, 2008 define('DB_SERVER', 'localhost'); only works if the mysql server is on the same machine as the web server - often *not* the case. 'localhost' means 'the local machine, not a different one' in internet speak. How do I check that using my ip's control panel? i don't know. it's different for every hosting company. if you remember how to get in and create a mysql database, it should be in the same area. somewhere in there it should give you the name of the machine that the mysql server is running on. maybe the phpmyadmin will tell you too...i forget, i've never used it to learn the server's name, just to modify tables. if you're really at a loss, call your isp and ask questions. they should be there to support you.
chamtech Posted April 4, 2008 Author Posted April 4, 2008 Thanks to all I am going to test your answers. Just a word of cautious to the newbees, you should always backup your configure.php before making any modifications to it. I was testing someone's comments about the changes to configure.php and I forgot that the information at the bottom of the configure.php are set during the installation and therefore, you can't copy over this file from your the one you locally have in your PC. Cheers :rolleyes:
Guest Posted April 4, 2008 Posted April 4, 2008 When you signed up for your hosting account they should have sent a link to your control panel (CPanel, Helm, Plesk). From there just click on the Data Base icon and it will tell you what data bases you have installed on your server. Maybe keep a copy of configure-local.php and configure-web.php on your site. Then if you do copy over them you have a backup available with all the correct settings.
chamtech Posted April 4, 2008 Author Posted April 4, 2008 Is the password encrypted in the configure.php file? or I can just type the password in its entry? define('DB_SERVER_PASSWORD', ''); Thanks again
chamtech Posted April 4, 2008 Author Posted April 4, 2008 I finally was able to connect to my site, but now looks like all the images are gone and I am now clueless of what have I done and how can I restore this site back to what it was before. Visit My Website Any idea? Thanks
Recommended Posts
Archived
This topic is now archived and is closed to further replies.