MacPorts provides a repository for all developer apps that might think of. So DO NOT, I REPEAT DO NOT attempt to install anything by hand it is a waste of time, because MacPorts had done it for you already!
So fisrt you need to install MacPorts, then whatever you want. Say you want MySQL just open Terminal type:
port search mysql
Then chose the package you want and type:
port install mysql5
And you have it on your sustem fully configured and ready to use.
Any other software is intalled in much the same way, so to recap: DO NOT TRY TO BE SMARTER AND INSTALL BY HAND - USE MACPORTS
Here is the official link: http://www.macports.org/