I have a fresh Joomla installation in a Mac OS X and I have configured a database to connect the application to. By default, Joomla uses localhost to connect (variable $host), but it does not work.

However, if I replace localhost with it does connect. I have installed MySQL using MacPorts.

It seems this is the opposite problem asked in another question.

What can I do to be able to use localhost instead of plain IP?

Here is my /etc/hosts content:

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##       localhost broadcasthost
::1             localhost 
fe80::1%lo0     localhost


1 Answer 1


Add localhost

To the hosts file, found at this location


Save the hosts file and restart your web server. The hosts file maps IP addresses, such as, with hostnames, such as localhost.

Here is a tutorial on the Mac hosts file.

  • As you can see in my question update, my /etc/hosts had that line already :)
    – elitalon
    Jul 1, 2011 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.