Can you explain to me how to set port number for a Database configuration :
class MY_Model extends CI_Model
{
protected static $db2_loaded = false;
protected static $db2 = false;
function __construct()
{
parent::__construct();
if(($this->session->userdata('login_user')!=false) && !self::$db2_loaded)
{
self::$db2_loaded = true;
$config['hostname'] = "localhost";
$config['username'] = "root";
$config['password'] = "";
$config['database'] = $this->session->userdata('bdd_compte');
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = TRUE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";
self::$db2 = $this->load->database($config,TRUE);
}
$this->db = self::$db2;
}
}
Any ideas how should I set a different port number
Thanks!
Use the port
key in database.php
.
$db['default']['port'] = 5432;
OR
$db['default']['hostname'] = "mysqlhost.yourdomain.com:3310";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With