Somebody should file a bug at http://bugs.sugarcrm.com/ -- the ability to specify a port number should be part of Sugar's installer.
The temporary fix depends on whether you're using the mysql or mysqli extensions. Look at the error message you get... if the function referenced is mysql_connect(, follow these directions:
1) open ./include/database/MysqlManager.php and find this line:
PHP Code:
$this->database = mysql_connect($configOptions['db_host_name'],$configOptions['db_user_name'],$configOptions['db_password']) or sugar_die("Could not connect to server ".$configOptions['db_host_name']." as ".$configOptions['db_user_name'].".".mysql_error());
2) replace the above line with the following lines:
PHP Code:
$db_hostname = $configOptions['db_host_name'];
if (!empty($configOptions['db_port'])) {
$db_hostname .= ":{$configOptions['db_port']}";
}
$this->database = mysql_connect($db_hostname,$configOptions['db_user_name'],$configOptions['db_password']) or sugar_die("Could not connect to server ".$configOptions['db_host_name']." as ".$configOptions['db_user_name'].".".mysql_error());
3) save the file
4) open config.php and find the 'dbconfig' section, i.e.:
PHP Code:
'dbconfig' =>
array (
'db_host_name' => 'localhost',
'db_host_instance' => 'SQLEXPRESS',
5) add a line above the db_host_name parameter for db_port, i.e.:
PHP Code:
'dbconfig' =>
array (
'db_port' => '6920',
'db_host_name' => 'localhost',
'db_host_instance' => 'SQLEXPRESS',
6) save config.php and enjoy!
A similar fix for mysqli can be made in ./include/database/MysqliManager.php if you need to.
Bookmarks