Just go to MySQL.com and download the latest version for Linux/Sparc (if there is one). Un-gzip/tar it and follow the installation instructions (usually provided in a file called README, README.[platform] or INSTALL). You will need to be root to install MySQL.
Build Apache, build PHP, run Apache, be happy. 🙂