Database connection error - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Database connection error (/showthread.php?tid=42172) |
Database connection error - El Forum - 05-28-2011 [eluser]igniterman[/eluser] Hi, I'm trying to set up wamp at home, but getting this error message: Quote:Unable to connect to your database server using the provided settings. Already checked config/database.php, a post elsewhere suggesting setting pconnect to false, so tried that too, but it didnt help. Also double-checked username/password details and db name, all correct (although not submitted here) Other than host,user,pwd,db, and now pconnect, the rest are the default settings. Code: $db['default']['hostname'] = 'localhost'; Any suggestions please? Any ideas gratefully received. Thanks! Database connection error - El Forum - 05-28-2011 [eluser]InsiteFX[/eluser] Did you load the database? InsiteFX Database connection error - El Forum - 05-28-2011 [eluser]John_Betong_002[/eluser] Try this: Save this code to ./application/config/database_DEBUG.php Code: <?php Then include the file in your database.php ./application/config/database.php Code: ... Database connection error - El Forum - 05-28-2011 [eluser]igniterman[/eluser] Thanks for this. I still get an error, and can't explain it: The output of the above is an error, it breaks at the mysql_connect: Code: Message: mysql_connect() [function.mysql-connect]: Access denied for user 'my_user'@'localhost' (using password: YES) Actually, I tried moving the line for mysql_select_db to be above the mysql_connect. That changed the error message to start mentioning the correct database name, but the username reported in the error was blank. Moving it back again to where it is above, means that the error message doesn't mention the database name. i.e. it becomes Code: Cannot connect to the database because: Access denied for user ''@'localhost' to database 'my_db' Database connection error - El Forum - 05-28-2011 [eluser]igniterman[/eluser] OK, I think I'm back in business. I changed the permissions for the user I created to apply to the Local host instead of to Any host. That did the trick. Thanks! Database connection error - El Forum - 06-01-2011 [eluser]Unknown[/eluser] Thnks! I has this problem too... Database connection error - El Forum - 08-19-2011 [eluser]dsp77[/eluser] when i access my main page i receive: Code: A Database Error Occurred Code: Array Database connection error - El Forum - 08-19-2011 [eluser]dsp77[/eluser] problem solved [db_debug] => must be false Database connection error - El Forum - 03-07-2012 [eluser]Unknown[/eluser] In my Wamp it all worked perfectly. when uploaded to another server (which is running older versions of mysql and php btw) i first got the same error. After some mods that led to nowhere, i just simply left the username and password blank, and then it connected perfectly. no other mods were necessary or debug code proved helpful. |