我试图连接我的codeigniter php到phpmyadmin mysql数据库都运行在docker容器上,但它说Message: mysqli::real_connect(): (HY000/2002): Connection refused
Unable to connect to your database server using the provided settings.
我在localhost运行phpmyadmin:8082和我的codeigniter是在localhost运行:8080
这是我的database.php配置
$db['default'] = array(
'dsn' => '',
'hostname' => '172.20.0.3', // Use 'localhost' or '127.0.0.1' for a local MySQL database
'username' => 'root',
'password' => 'testpassword',
'database' => 'sortdb',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
1条答案
按热度按时间xmjla07d1#
通常
root
只能访问localhost
。您可能需要
警告:从远程主机
GRANT
完全权限到root是不安全的。