I prefer to install mySQL using the pre-compiled binaries. Depending on the environment, these usually go in either /opt or /usr/local. When you choose this type of install, chances are you are going to need to ensure that you somehow configure your system so that the mysql binaries end up in your PATH.
If you are using RedHat or CentOS, a good way to do this is to add a custom file inside of the /etc/profile.d/ directory. I create one called “mysql.sh”:
if ! echo ${PATH} | /bin/grep -q /opt/mysql/bin ; then
PATH=/opt/mysql/bin:${PATH}
fi
This script simply checks you PATH for mysql and adds it if it’s not already there.
If you are using Ubuntu, you can edit /etc/environment:
PATH="/usr/local/bin:/usr/bin:/bin:/opt/mysql/bin" LANG="en_US.UTF-8"
You can see that I’ve just added “:/opt/mysql/bin” to the end of the PATH line.
There are lots of other ways to do this, and I’m sure some distributions not covered here do it differently. If you know of a different or better way, I look forward to your comments.