I was unable to connect to MySQL 5 on port 3307
Database is hosted on mysql5.mydomain.co.uk on port 3307. I am using mysql5, PHP 5.1.4 & mysqli
I could connect to my database using MySQL Admin using the above hostname & port, with the same username, password & dbname
When I attempted to connect with CI using mysql5.mydomain.co.uk:3307 as the hostname I got the error message:
Message: mysqli_connect() [function.mysqli-connect.php]: (HY000/2005): Unknown MySQL server host ‘mysql5.mydomain.co.uk:3307’ (11004)
Leaving off the port suffix gave:
Message: mysqli_connect() [function.mysqli-connect.php]: (28000/1045): Access denied for user ‘xxxxx’@‘85.13.212.2’ (using password: YES)
Eventually fixed this by adding $db[‘mydb’][‘port’] to /config/database.php and amending mysqli_driver.php as below:
function db_connect()
{
return @ mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port);
}
Hope this is helpful to others
