【发布时间】:2016-10-29 00:00:17
【问题描述】:
我正在尝试使用 Codeigniter 远程连接到我们的实时数据库。但是我收到一个错误:
消息:mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'10.54.9.20' (using password: YES)
Database.php 配置文件:
$db['default'] = array(
'dsn' => '',
'hostname' => 'xx.xx.xxx.xxx',
'username' => 'username',
'password' => 'password',
'database' => 'database',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE, //tried changing this to TRUE
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
我在本地主机中使用数据库没有问题,但是在使用远程配置时出现错误。
需要帮助。谢谢大家!
【问题讨论】:
-
你可能需要一些 GRANTS
-
嗨,德鲁,是的,正如 1000111 在他的评论中所说的那样。但我不确定在哪里运行这个命令。我尝试通过 SSH 访问服务器,但 GRANT 未被识别为命令。它说:如果 'grant' 不是错字,您可以使用 command-not-found 来查找包含它的包......等等。
-
被问了无数次,也得到了回答!很高兴你成功了。
标签: php mysql codeigniter mysqli ssh