CodeIgniter Forums
Database error occurred. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Database error occurred. (/showthread.php?tid=62246)



Database error occurred. - capt.enos - 06-23-2015

Hi, I'm newbie for this framework, i has tried many ways to fix this problem but still database not connected/error.
so, i need help.
screen looks like this :

A Database Error Occurred
SQLSTATE[28000] [1045] Access denied for user 'root'@localhost (using password: NO)
Filename: third_party/MX/Base.php
Line Number: 55

what should i do for this error?
please help me.

Thanks.


RE: Database error occurred. - capt.enos - 06-24-2015

Anyone can help?
i still can't connect codeigniter to mysql,


A Database Error Occurred

SQLSTATE[28000] [1045] Access denied for user 'root'@localhost (using password: NO)

Filename: third_party/MX/Base.php

Line Number: 55

Please help me.
thanks.


RE: Database error occurred. - CroNiX - 06-24-2015

Are the db credentials properly set in /application/config/database.php? Does that mysql user have proper permissions set up? According to the error message, you are trying to use the "root" mysql user with NO password.


RE: Database error occurred. - capt.enos - 06-24-2015

(06-24-2015, 09:00 AM)CroNiX Wrote: Are the db credentials properly set in /application/config/database.php? Does that mysql user have proper permissions set up? According to the error message, you are trying to use the "root" mysql user with NO password.

Finaly i can access database, but i got new error,

A Database Error Occurred
Error Number: 1146
Table 'cpp_db.UI_USERS' doesn't exist
select SALT as RESULT from UI_USERS where USERNAME='admin'
Filename: helpers/system_helper.php
Line Number: 153

I open file helpers/system_helper.php and i change all UI_USERS to lowercase because in my database all table is in lowercase, after i changed it nothing happen still same error.

by the way thanks for your answer. i appreciate it.


RE: Database error occurred. - mwhitney - 06-29-2015

(06-24-2015, 06:11 PM)capt.enos Wrote: Finaly i can access database, but i got new error,

A Database Error Occurred
Error Number: 1146
Table 'cpp_db.UI_USERS' doesn't exist
select SALT as RESULT from UI_USERS where USERNAME='admin'
Filename: helpers/system_helper.php
Line Number: 153

I open file helpers/system_helper.php and i change all UI_USERS to lowercase because in my database all table is in lowercase, after i changed it nothing happen still same error.

by the way thanks for your answer. i appreciate it.

Most databases don't care about the case for table and column names, but it is a good idea to be consistent. This error is pretty straight-forward, though. Are you sure the UI_USERS table exists in the database named cpp_db? Does the user have permission to access this table in this database?

In general, when trying to setup a site with code that already works for someone else, I start with the assumption that the error is in the configuration, and don't touch code until I'm absolutely certain that I've covered all of the potential configuration issues.