A Database Error Occurred! fixed by db_debug set to false?


Hi I just want to clear the question in my mind. I got an error

Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346

after reading some of issue about that error I try to set $db['default']['db_debug'] = TRUE; to $db['default']['db_debug'] = FALSE; and it works!

as I read this in manual of CI Database Configuration

db_debug - TRUE/FALSE (boolean) - Whether database errors should be displayed.

I want to know that does really fix the problem or hiding not the error, but if it only hiding it how come it works? I am worried that it may cause future problem.

same question exist <a href="https://stackoverflow.com/questions/12327775/database-connection-settings-with-db-debug-set-as-false%5Benter%20link%20description%20here%5D%5B1%5D" rel="nofollow">here</a>.

any information and ideas is big help and well appreciated.Many Thanks!


Try to $db['default']['pconnect'] = TRUE; set to false rather than $db['default']['db_debug'] = TRUE;


I found why. In my situation, database error because my mysql config in php.ini is not right.

CI works well after I set mysql config in php.ini, like this:

[Mysql] mysql.default_socket = /tmp/mysql.sock

If you didn't configure php.ini, the default socket is /var/mysql/mysql.sock, please check it.

I also set $db['default']['db_debug] to FALSE before, it looks ok, but no. It's just hide the error of mysql config, when I test to read from tables of mysql, I got nothing and didn't know why nothing. So I debug it, i found because my mysql connection was not established. :(


Its worked for me

$db['default']['pconnect'] = FALSE;


  • Fatal error: Call to undefined method CI_DB_pdo_driver::where() in
  • Connecting to mulitple databases with DMZ DataMapper
  • WAMP Mysqli not working whereas Mysql works
  • How to connect to a User DSN using codeigniter?
  • how to set id for each item in ListView
  • Initialization section of the package
  • calling a fragment from fragment
  • to implement a spinner in angular2+
  • MVC - @Html.CheckBoxFor
  • System.InvalidCastException: Specified cast is not valid
  • How can I extract results of aggregate queries in slick?
  • OOP Javascript - Is “get property” method necessary?
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • MongoDB in PHP using aggregate to group by _id is null not working
  • Display issues when we change from one jquery mobile page to another in firefox
  • Different response to non-authenticated users and AJAX calls
  • PHP - How to update data to MySQL when click a radio button
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Modifying destination and filename of gulp-svg-sprite
  • ILMerge & Keep Assembly Name
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Large data - storage and query
  • WOWZA + RTMP + HTML5 Playback?
  • GridView Sorting works once only
  • Data Validation Drop Down Box Arrow Disappearing
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • How to stop GridView from loading again when I press back button?
  • Turn off referential integrity in Derby? is it possible?
  • Qt: Run a script BEFORE make
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • Busy indicator not showing up in wpf window [duplicate]
  • reshape alternating columns in less time and using less memory
  • costura.fody for a dll that references another dll
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Binding checkboxes to object values in AngularJs
  • How can I use `wmic` in a Windows PE script?