Guide on how to install MySQL 5 on FreeBSD
Installing MySQL 5 on FreeBSD is really quite simple and very easy. This guide will help you install MySQL 5 from ports.
As root
cd /usr/ports/databases/mysql51-server
make install clean
Once done you need to add the following line to /etc/rc.conf
As root
mysql_enable="YES"
If you don’t feel like editing the file manually you can append it to /etc/rc.conf like this:
As root
echo mysql_enable=\"YES\" >> /etc/rc.conf
Start up MySQL manually or reboot. To start up MySQL manually run the following command.
As root
sh /usr/local/etc/rc.d/mysql-server start
Check if things are running
As any user
ps -waux | grep mysql
If you get an output similar to the one below that means that things are running as intended.
Output
mysql 801 0.0 0.0 34921 14409 con- I 10:45PM 0:00.01 /bin/sh /usr/local/bin/mysqld_safe –defaults-extra-file=/var/db/mysql/my.cnf –user=mysql –datadir=/var/db/mysql –pid-file=/var/db/mysql/name.domain.xxx.pid
mysql 850 0.0 0.6 44652 21654 con- I 10:45PM 0:00.16 /usr/local/libexec/mysqld –defaults-extra-file=/var/db /mysql/my.cnf –basedir=/usr/local –datadir=/var/db/mysql –log-error=/var/db/mysql/name.domain.xxx –pid-file=/var/db/mysql/name
Securing MySQL
MySQL comes with a standard password which makes you vulnerable so we need to protect the MySQL server with a unique password. To do this type the following and replace “uniquepassword” with the password you would like.
As root
/usr/local/bin/mysqladmin -u root password uniquepassword
Related Guides Links Requirements