$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'bd1',
'password' => 'pass3214',
'database' => 'db1',
'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['conncetdbtest'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'db2',
'password' => 'pass123',
'database' => 'db2',
'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
);
test.php 视图 中的
<?php
$DB2 = $this->load->database('conncetdbtest' , TRUE);
$querydb2 = $DB2 ->select('*')->get('test');
print_r($querydb2);
?>
当我运行代码时,显示消息:mysqli :: real_connect():( HY000 / 1045):拒绝访问用户'db2'@'localhost'(使用密码:YES)。
无法解决。请帮我 。