Welcome Guest, Not a member yet? Register   Sign In
localhost instead of domain
#1

[eluser]rcahanap[/eluser]
New to setting up configs for mysql /code igniter.

In the application/config/database.php file, there is a default variable ('hostname') that you can set.

I had mine set like this:
$db['default']['hostname']="biboba.com";

But I was getting errors.

I changed it to this, and it was OK:
$db['default']['localhost'];

Can someone explain what's the difference?

According to the docs:
['hostname'] The hostname of your database server.

But this is not working.

Thank you in advance for your replies.

-Roberto
#2

[eluser]Aken[/eluser]
The hostname is the host server where the MySQL database is installed. "localhost" is the most common hostname, but is not always the correct value.

http://dev.mysql.com/doc/refman/5.0/en/connecting.html
#3

[eluser]sith4life[/eluser]
go into /application/config/database.php and edit
Code:
$db['default']['hostname'] = 'localhost'; // this is dependent on your webhost
$db['default']['username'] = 'dbusername';
$db['default']['password'] = 'dbpass';
$db['default']['database'] = 'dbname';// database name that you will be pulling information from
$db['default']['dbdriver'] = 'mysql'; // from here down should be default
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
if you edit those settings with the proper values you will be able to connect to the database
Code:
$db[‘default’][‘localhost’];
i'm not sure what you mean by it works because you aren't assigning any value to that index in the db array.
#4

[eluser]rcahanap[/eluser]
Hello Aken! Thanks for responding.

Let me click on that link and read then.

-Roberto
#5

[eluser]rcahanap[/eluser]
Hello sith4life!

I meant to say, I had this:
$db['default']['hostname'] = "localhost";

That worked.

The "explanation" of the variables said:
['hostname'] The hostname of your database server.

The hostname is "dblogix.com". But when I tried that, it did not work.

-Roberto
#6

[eluser]Aken[/eluser]
If it didn't work, then it clearly is not the correct hostname Wink Domain name and MySQL hostname are two different things.
#7

[eluser]sith4life[/eluser]
yea the docs are assume you understand that you know the difference between a MySQL Hostname and a webhost. "localhost" in your case is synonymous with "dlblogix.com" but CI will look in your root directory for the Database and not find it because it's on a different part of the server. I hope this makes sense.




Theme © iAndrew 2016 - Forum software by © MyBB