Welcome Guest, Not a member yet? Register   Sign In
Database Error - pulling my hair out
#11

[eluser]gypmaster[/eluser]
Hey Chad,

Thanks for those suggestions.

I tried both and nothing changed.

Still just getting the Database Error page - not even getting the sql error
#12

[eluser]gypmaster[/eluser]
Hey Jedd,

Where would I put the standard php code? in index.php or somewhere else?
#13

[eluser]jedd[/eluser]
Very much elsewhere - outside CI's scope.

Have you not done any non-CI PHP/MySQL programming before?
#14

[eluser]gypmaster[/eluser]
Hey Jedd,

Yes, I have plenty of php/mysql experience outside of CI.

I just wasn't sure what you were asking me to test ... but I think I understand now.

Here's a snippet I 'wrote' to test for connect or failure using the server/uname/pword/db parameters I listed above - I ran the code outside of the CI folder but on the same webserver.

Code:
<?php
mysql_connect('localhost','weddingr_cidb','mark1234') or die("uh oh: ".mysql_error());
mysql_select_db('weddingr_cidb') or die("no db: ".mysql_error());

it connected just fine, no errors thrown ... so I'm pretty convinced it's not a server/uname/pword/db issue ...
#15

[eluser]jedd[/eluser]
Well, I'm poop-outta ideas then.

Grasping-at-straws suggestions (absent useful access to any logfiles)
o disable persistent connections - there's occasionally weirdness with these on shared hosts
o change localhost to 127.0.0.1 - as mysql's db connect stuff will attempt to talk to a local socket as a first preference

Note that I really can't see either of those making didly squat difference in this instance, especially if you've got conventional code accessing the db just fine.

As you've no doubt discovered, the stuff you're feeding into CI is pretty much what you'd do manually. You could put some debug statements in the CI database library, just to echo out the credentials and make sure that just before it tries to connect, it's using the same credentials you think it's using.
#16

[eluser]gypmaster[/eluser]
I've hacked the code in CI_DB_driver function in DB_Driver.php to echo out each of the values - heres what it shows:

hostname - 127.0.0.1
username - weddingr_cidb
password - mark1234
database - weddingr_cidb
dbdriver - mysql
dbprefix -
pconnect - 1
db_debug - 1
cache_on -
cachedir -
char_set - utf8
dbcollat - utf8_general_ci

no surprises there then. I think I'll clear down completely and try another install ... again.

Thanks for trying guys.
#17

[eluser]Chad Fulton[/eluser]
Whoops, sorry, my last advice doesn't work if you're using persistant connections.

You should try the same thing, except instead of changing the db_connect function, replace the db_pconnect function, or you could do what I suggested about and set the pconnect to false.
#18

[eluser]mistycabal[/eluser]
Try changing:
Quote:$db['default']['username'] = "weddingr_cidb";

To:
$db['default']['username'] = "weddingr";

Most hosts, including hostgator, make the database name by taking your username, adding an underscore, and then the databasename you entered. Which would mean that the username isn't the entire thing, only the first half.
#19

[eluser]CI Lee[/eluser]
Did you ever solve this?

I am experiencing the exact same issue that you were/are with Host Gator.

-Lee



Fixed: Turns out that if the user is using an autogenerated Hostgator password it wont connect. If you sent a simple one not using ~=+ then it works.
#20

[eluser]stef25[/eluser]
nice catch




Theme © iAndrew 2016 - Forum software by © MyBB