On my Unix web server, I have two MySQL database servers running. One on port 3306, and another on 3307. I wanted to specify the port number of database to connect in /config/database.php of codeigniter.
I tried this….
$database['hostname'] = "localhost:3307";
This did not work. The webapp connected to database on port 3306.
Then I tried this….
$database['hostname'] = "127.0.0.1:3307";
This worked. The webapp got connected to the database on port 3307.
I don’t understand why? Can somebody please throw some light on this.
I think this is not a codeigniter specific issue inspite of the title.
Regards
I’d guess localhost is valid for IPv6 also, but 127.0.0.1 is undeniably an IPv4 address, so therefore it might throw some spanners into your machinery.
I’ve run into that a few times. (FireFox is/was notorious for being slow on localhost:8000 but fast on 127.0.0.1:8000 when developing with Django)