oneeezy Posted January 12, 2010 Posted January 12, 2010 Hey guys, I am getting this warning message: Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/s/o/u/southerncravin/html/Catalog/includes/functions/database.php on line 19 Unable to connect to database server! you can view it here: http://www.theclassypeacock.com/Catalog/index.php _________________________________________________________________________ What I'm trying to do is transfer over an existing oscommerce website to a new domain with different MySQL username, password, etc.. am I supposed to edit any certain files in any code? This is my database.php file where it says I have the Warning in.. <?php /* $Id: database.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2007 osCommerce Released under the GNU General Public License */ function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } if ($$link) mysql_select_db($database); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } function tep_db_error($query, $errno, $error) { die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>'); } function tep_db_query($query, $link = 'db_link') { global $$link; if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); } $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error()); if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { $result_error = mysql_error(); error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); } return $result; } function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { reset($data); if ($action == 'insert') { $query = 'insert into ' . $table . ' ('; while (list($columns, ) = each($data)) { $query .= $columns . ', '; } $query = substr($query, 0, -2) . ') values ('; reset($data); while (list(, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= 'now(), '; break; case 'null': $query .= 'null, '; break; default: $query .= '\'' . tep_db_input($value) . '\', '; break; } } $query = substr($query, 0, -2) . ')'; } elseif ($action == 'update') { $query = 'update ' . $table . ' set '; while (list($columns, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= $columns . ' = now(), '; break; case 'null': $query .= $columns .= ' = null, '; break; default: $query .= $columns . ' = \'' . tep_db_input($value) . '\', '; break; } } $query = substr($query, 0, -2) . ' where ' . $parameters; } return tep_db_query($query, $link); } function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } function tep_db_num_rows($db_query) { return mysql_num_rows($db_query); } function tep_db_data_seek($db_query, $row_number) { return mysql_data_seek($db_query, $row_number); } function tep_db_insert_id($link = 'db_link') { global $$link; return mysql_insert_id($$link); } function tep_db_free_result($db_query) { return mysql_free_result($db_query); } function tep_db_fetch_fields($db_query) { return mysql_fetch_field($db_query); } function tep_db_output($string) { return htmlspecialchars($string); } function tep_db_input($string, $link = 'db_link') { global $$link; if (function_exists('mysql_real_escape_string')) { return mysql_real_escape_string($string, $$link); } elseif (function_exists('mysql_escape_string')) { return mysql_escape_string($string); } return addslashes($string); } function tep_db_prepare_input($string) { if (is_string($string)) { return trim(tep_sanitize_string(stripslashes($string))); } elseif (is_array($string)) { reset($string); while (list($key, $value) = each($string)) { $string[$key] = tep_db_prepare_input($value); } return $string; } else { return $string; } } ?> any help would be appreciated! Thanks guys.. Justin Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!
oneeezy Posted January 12, 2010 Author Posted January 12, 2010 I would like to add that this '/usr/local/mysql-5.0/data/mysql.sock' has the word 'mysql-5.0' but when i was setting up my database name i chose the 'mysql-4.1' so i wonder.. Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!
classictouch Posted January 12, 2010 Posted January 12, 2010 Hey guys, I am getting this warning message: Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/s/o/u/southerncravin/html/Catalog/includes/functions/database.php on line 19 Unable to connect to database server! you can view it here: http://www.theclassypeacock.com/Catalog/index.php _________________________________________________________________________ What I'm trying to do is transfer over an existing oscommerce website to a new domain with different MySQL username, password, etc.. am I supposed to edit any certain files in any code? This is my database.php file where it says I have the Warning in.. <?php /* $Id: database.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2007 osCommerce Released under the GNU General Public License */ function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } if ($$link) mysql_select_db($database); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } function tep_db_error($query, $errno, $error) { die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>'); } function tep_db_query($query, $link = 'db_link') { global $$link; if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); } $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error()); if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) { $result_error = mysql_error(); error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); } return $result; } function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { reset($data); if ($action == 'insert') { $query = 'insert into ' . $table . ' ('; while (list($columns, ) = each($data)) { $query .= $columns . ', '; } $query = substr($query, 0, -2) . ') values ('; reset($data); while (list(, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= 'now(), '; break; case 'null': $query .= 'null, '; break; default: $query .= '\'' . tep_db_input($value) . '\', '; break; } } $query = substr($query, 0, -2) . ')'; } elseif ($action == 'update') { $query = 'update ' . $table . ' set '; while (list($columns, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= $columns . ' = now(), '; break; case 'null': $query .= $columns .= ' = null, '; break; default: $query .= $columns . ' = \'' . tep_db_input($value) . '\', '; break; } } $query = substr($query, 0, -2) . ' where ' . $parameters; } return tep_db_query($query, $link); } function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } function tep_db_num_rows($db_query) { return mysql_num_rows($db_query); } function tep_db_data_seek($db_query, $row_number) { return mysql_data_seek($db_query, $row_number); } function tep_db_insert_id($link = 'db_link') { global $$link; return mysql_insert_id($$link); } function tep_db_free_result($db_query) { return mysql_free_result($db_query); } function tep_db_fetch_fields($db_query) { return mysql_fetch_field($db_query); } function tep_db_output($string) { return htmlspecialchars($string); } function tep_db_input($string, $link = 'db_link') { global $$link; if (function_exists('mysql_real_escape_string')) { return mysql_real_escape_string($string, $$link); } elseif (function_exists('mysql_escape_string')) { return mysql_escape_string($string); } return addslashes($string); } function tep_db_prepare_input($string) { if (is_string($string)) { return trim(tep_sanitize_string(stripslashes($string))); } elseif (is_array($string)) { reset($string); while (list($key, $value) = each($string)) { $string[$key] = tep_db_prepare_input($value); } return $string; } else { return $string; } } ?> any help would be appreciated! Thanks guys.. Justin
oneeezy Posted January 12, 2010 Author Posted January 12, 2010 yes, thankyou classictouch Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!
♥mdtaylorlrim Posted January 12, 2010 Posted January 12, 2010 The catalog/includes/configure.php and catalog/admin/includes/configure.php holds the connect data for the database. The error is showing in the database.php file only because that is the script that is running at the time, but it is calling bad data out of the configure.php files. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
oneeezy Posted January 12, 2010 Author Posted January 12, 2010 The catalog/includes/configure.php and catalog/admin/includes/configure.php holds the connect data for the database. The error is showing in the database.php file only because that is the script that is running at the time, but it is calling bad data out of the configure.php files. ok cool thanks.., i have a question about the define('DIR_FS_CATALOG', ''); on line 21.. if im not mistaken that is the url to my catalog correct? which link would that be if my catalog is on http://www.theclassypeacock.com/Catalog/index.php? Here is a look at my current code.. usernames/passwords have been omitted <?php define('HTTP_SERVER', 'http://72.167.232.212'); define('HTTPS_SERVER', 'http://72.167.232.212'); define('ENABLE_SSL', false); define('HTTP_COOKIE_DOMAIN', '72.167.232.212'); define('HTTPS_COOKIE_DOMAIN', '72.167.232.212'); define('HTTP_COOKIE_PATH', '/'); define('HTTPS_COOKIE_PATH', '/'); define('DIR_WS_HTTP_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/'); define('DIR_FS_CATALOG', '/home/myweddin/public_html/'); <----------- I NEED TO KNOW WHAT GOES HERE? (WHAT YOU SEEN THERE NOW IS MY LAST URL) define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', '*********'); define('DB_SERVER_PASSWORD', '*********'); define('DB_DATABASE', '*********'); define('USE_PCONNECT', 'false'); define('STORE_SESSIONS', 'mysql'); ?> Any help would be appreciated thanks Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!
oneeezy Posted January 12, 2010 Author Posted January 12, 2010 ah! this is driving me crazy.. ok i exported the old SQL dump file and tried to load it up and i get an error that it was trying to use the old SQL username so i went in manually into the .sql file and changed the usernames to correct db name. now I'm getting this error when i try to import the sql file: ------------------------------------------------------------------------------------------------ Error SQL query: CREATE DATABASE `theclassypeacock` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; MySQL said: Documentation #1007 - Can't create database 'theclassypeacock'; database exists ------------------------------------------------------------------------------------------------ yes, 'theclassypeacock' is my new db server name.., so what am i doing wrong? Maybe Im exporting the database wrong possibly? Or is it possibly my configuration files? I changed both config files up correctly i believe but I will post them up here anyways.. Catalog/includes/configure.php <?php define('HTTP_SERVER', 'http://72.167.232.212'); define('HTTPS_SERVER', 'http://72.167.232.212'); define('ENABLE_SSL', false); define('HTTP_COOKIE_DOMAIN', 'http://72.167.232.212'); define('HTTPS_COOKIE_DOMAIN', 'http://72.167.232.212'); define('HTTP_COOKIE_PATH', '/'); define('HTTPS_COOKIE_PATH', '/'); define('DIR_WS_HTTP_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/'); define('DIR_FS_CATALOG', '/home/content/s/o/u/southerncravin/html/Catalog/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'theclassypeacock'); define('DB_SERVER_PASSWORD', '******'); define('DB_DATABASE', 'theclassypeacock'); define('USE_PCONNECT', 'false'); define('STORE_SESSIONS', 'mysql'); ?> Catalog/admin/includes/configure.php <?php define('HTTP_SERVER', 'http://72.167.232.212'); define('HTTP_CATALOG_SERVER', 'http://72.167.232.212'); define('HTTPS_CATALOG_SERVER', 'http://72.167.232.212'); define('ENABLE_SSL_CATALOG', 'false'); define('DIR_FS_DOCUMENT_ROOT', '/home/content/s/o/u/southerncravin/html/Catalog/'); define('DIR_WS_ADMIN', '/admin/'); define('DIR_FS_ADMIN', '/home/content/s/o/u/southerncravin/html/Catalog/admin/'); define('DIR_WS_CATALOG', '/'); define('DIR_FS_CATALOG', '/home/content/s/o/u/southerncravin/html/Catalog/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/'); define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/'); define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/'); define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/'); define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/'); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'theclassypeacock'); define('DB_SERVER_PASSWORD', '*********'); define('DB_DATABASE', 'theclassypeacock'); define('USE_PCONNECT', 'false'); define('STORE_SESSIONS', 'mysql'); ?> Once again, the store should be showing up at this link http://www.theclassypeacock.com/Catalog/index.php Alright, thanks for all your help and I'm sorry for being a pesky noob Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!
♥mdtaylorlrim Posted January 12, 2010 Posted January 12, 2010 So, do you actually have the knowledge to test the database connection from the local machine to the mysql instance on localhost, using username theclassypeacock and a password? Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
oneeezy Posted January 12, 2010 Author Posted January 12, 2010 So, do you actually have the knowledge to test the database connection from the local machine to the mysql instance on localhost, using username theclassypeacock and a password? All i have done is installed oscommerce one other time and now im trying to use that same template i made to go off of instead of having to redo everything again.. I've never had to import and old sql dump before.. so the answer to your question is no, I do not have all the knowledge i need..is there a good tutorial somwhere? Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!
♥mdtaylorlrim Posted January 13, 2010 Posted January 13, 2010 All i have done is installed oscommerce one other time and now im trying to use that same template i made to go off of instead of having to redo everything again.. I've never had to import and old sql dump before.. so the answer to your question is no, I do not have all the knowledge i need..is there a good tutorial somwhere? Personally, I think you're way over your head here... a lot more info is needed to help you out any more. Things like... Are you running this on your PC from home? Do you really have mySQL installed? How did you set up your database? How did you set up the users? How did you set up your passwords? Of course, if you really have a hosting company hosting your site they can tell you all this information. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
oneeezy Posted January 13, 2010 Author Posted January 13, 2010 Personally, I think you're way over your head here... a lot more info is needed to help you out any more. Things like... Are you running this on your PC from home? Do you really have mySQL installed? How did you set up your database? How did you set up the users? How did you set up your passwords? Of course, if you really have a hosting company hosting your site they can tell you all this information. Are you running this on your PC from home? NO Do you really have mySQL installed? YES How did you set up your database? I DID IT ON CANACA AND ON GODADDY THROUGH THERE CONTROL PANELS How did you set up the users? ONLY USER IS ME How did you set up your passwords? ONLY ONE PASSWORD Ok, here is the updates and what is exactly going on.. I have hosting with canaca.com and a prebuilt oscommerce site that i made/tweaked out/ and added lots of contribs to..(http://66.49.195.144/index.php) and I'm trying to transfer it over to our servers at godaddy.com, well I have been on the phone with godaddy for like hours today..i sent them the mySQL file from canaca and they came to the conclusion that i should just try dropping my tables.. but thats all they said and they could not help me further and said it was out of there hands.. I kno there is a button to drop tables in phpMyAdmin, but were they talking about dropping my tables in my original MySQL file on canaca and then trying to import it into godaddy? I'm to the point now to where i might just redo everything from scratch... I've done so much work already on my existing template but i feel like im out of options :/ Windows Phone 7 Forum | Tricks, Tips, Hacks, Apps, and Games for your Windows Phone 7!
♥mdtaylorlrim Posted January 13, 2010 Posted January 13, 2010 Ok, you have the means to do this... Using phpMyAdmin make sure you have a database that is named properly. Make sure it is empty of any tables at all. Using phpMyAdmin select to restore the database using a sql file on your local computer. When it prompts you for the file name just give it yourbackupfile.sql and it should restore the entire database. That does just the database. Using phpMyAdmin verify the users and passwords that can access the database, and the privileges. Make sure that info is in your configure.php files. See what results you get following that method. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.