由于您可能会使用MAMP,因此请将Port更改为默认值3306或在database.php中使用127.0.0.1
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',// leave it for port 3306
'username' => 'yourUserhere',
'password' => 'yourPassword',
'database' => 'yourDatabase',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
或使用默认设置:
$db['default'] = array(
'dsn' => '',
'hostname' => '127.0.0.1:8889',// leave it for port 8889
'username' => 'yourUserhere',
'password' => 'yourPassword',
'database' => 'yourDatabase',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);