提问人:Tristan 提问时间:10/13/2023 更新时间:10/14/2023 访问量:63
消息:mysqli::real_connect():(HY000/2002):在 docker 上运行的 phpmyadmin 中的连接被拒绝 - codeigniter
Message: mysqli::real_connect(): (HY000/2002): Connection refused in phpmyadmin running on docker - codeigniter
问:
我正在尝试将我的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:8082 中运行 phpmyadmin 我的codeigniter在localhost:8080中运行
这是我的数据库.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
);
答:
0赞
Rick James
10/14/2023
#1
通常只被授予访问权限。root
localhost
您可能需要
CREATE USER root @'172.20.0.3';
GRANT ... TO root @'172.20.0.3' ...;
警告:从远程主机获得 root 权限是不安全的。GRANT
评论