(Laravel 4), MySQL , 3306.
// :
'mysql' => array(
...
'host' => 'localhost',
'port' => '8889',
...
)
:
'mysql' => array(
...
'host' => 'localhost:8889',
...
)
:
https://github.com/laravel/laravel/issues/1182
Laravel, DRY (Do not Repeat Yourself), :
app/config/database.php:
$my_hostname = 'localhost';
$my_port = '8889';
$my_database = 'database';
$my_username = 'username';
$my_password = 'password';
if (App::runningInConsole()) {
$my_hostname = $my_hostname.':'.$my_port;
}
:
'mysql' => array(
'driver' => 'mysql',
'host' => $my_hostname,
'port' => $my_port,
'database' => $my_database,
'username' => $my_username,
'password' => $my_password,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),