![]() |
Coneccting to a database using MySQL port - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Coneccting to a database using MySQL port (/showthread.php?tid=2662) |
Coneccting to a database using MySQL port - El Forum - 08-17-2007 [eluser]Carlton[/eluser] Hey, I checked the documentation for the DB class and it mentions that port support when connecting to a DB is only supported when using the postgre driver type. Is there a reason for not including it for mysql/mysqli or is it just a case of not getting round to it. I checked the file at system/database/drivers/mysqli/mysqli_driver.php and noticed that within the 'db_connect' function you can add two extra parameters to 'mysqli_connect' (dbname and port) and it seems to work ok. I wondered if anyone has attempted something similar or could explain why the ports are not supported just yet. Thanks.... C Coneccting to a database using MySQL port - El Forum - 01-28-2008 [eluser]Unknown[/eluser] I was able to resolve this by setting the default port in the php.ini file used by MAMP: Code: mysql.default_port = 8889 If you haven't made changes to the php.ini files yet, you can get to them by going to the File->Edit Template menu in MAMP. I'm using MySQL and it seemed to use the default port just fine. Coneccting to a database using MySQL port - El Forum - 02-07-2008 [eluser]Unknown[/eluser] Not sure if this is exactly what you're talking about, or if it's too obvious, but you can specify a MySQL port in system/application/config/database.php on the following line: Code: $db['default']['hostname'] = "mysqlhost"; You can specify a (non-default) port for MySQL to connect to using the full MySQL hostname, like this: Code: $db['default']['hostname'] = "mysqlhost.yourdomain.com:3310"; I figured this out after discovering I didn't have permission to edit php.ini on my webserver. |