Installing MySQL on FreeBSD

MySQL can be installed on FreeBSD using the binary distribution which is provided by Oracle. The preferred and easiest way to install MySQL is to use the ‘mysql-server’ and ‘mysql-client’ ports which are available on website.

The advantage of using these ports are −

  • It comes with a working MySQL server and it contains all optimizations that are enabled, and help work on the user’s version of FreeBSD.

  • It is automatically configured and built.

  • The start up scripts are installed in /usr/local/etc/rc.d.

  • It gives the ability to the user to use pkg_info –L to see which of the files were installed.

  • It also gives the ability to the user to use pkg_delete to remove MySQL if it is no longer required on the machine.

The process to build MySQL requires GNU make (gmake) to work properly. If GNU make is not available, it has to be installed first, before MySQL is compiled.

The ports system can be installed using the below commands −

# cd /usr/ports/databases/mysql80−server
# make
# cd /usr/ports/databases/mysql80−client
# make

The standard port installation will place the server into /usr/local/libexec/mysqld, and the startup script for MySQL server is palced in /usr/local/etc/rc.d/mysql-server.

The MySQL server can be installed using the ports system using the below code −


# cd /usr/ports/databases/mysql80-server
# make deinstall
# cd /usr/ports/databases/mysql80-client
# make deinstall