Codeigniter错误“无法使用提供的设置连接到数据库服务器" [英] Codeigniter Error "Unable to connect to your database server using the provided settings"
问题描述
当我尝试在我的域上上传该项目时,遇到错误无法使用提供的设置连接到数据库服务器"
When I trying upload this project on my domain m facing error "Unable to connect to your database server using the provided settings"
我已经检查了我的 config.php 和 database.php 文件,所有信息均正确:
I have checked my config.php and database.php file and all the information are correct:
$db['default']['hostname'] = "etc.com";
$db['default']['username'] = "etc";
$db['default']['password'] = "etc@etc";
$db['default']['database'] = "visiting_link";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
这个问题有解决方案吗?请参阅任何帮助材料.我正在使用fileZilla.
谢谢!
Is any solution to that problem? please refer any helping material.
I am using fileZilla.
Thanks !
推荐答案
将"db_debug"设置为false解决了我的问题.
Setting "db_debug" to false solved my problem.
我正在使用Snow Leopard.
I'm using Snow Leopard.
db_debug混淆了我的方向.在我的情况下,解决方案只是mysql.sock引用路径,此问题已解决:
db_debug just obfuscated my direction. The solution in my case was just the mysql.sock reference path, as solved on this question: Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in
OS X使用/tmp/mysql.sock,默认情况下php.ini引用/var/mysql/mysql.sock.只需创建一个符号链接即可解决问题:
OS X use /tmp/mysql.sock, and by default php.ini is referencing /var/mysql/mysql.sock. Just creating a symlink solves the problem:
sudo mkdir -p /var/mysql/ && cd /var/mysql/
sudo ln -s /tmp/mysql.sock ./mysql.sock
这篇关于Codeigniter错误“无法使用提供的设置连接到数据库服务器"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!