Install MySQL 5.1.x
Presently MySQL 5.5 is the newest version on FreeBSD 8.1 repository. But, since it is still in beta, we will use MySQL 5.1 instead.
# pkg_add -r mysql51-server
This will have both MySQL 5.1 server and client installed.
There are several legitimate locations where MySQL configuration file, my.cnf, can be placed. We will put it in the directory /usr/local/etc. You can copy an appropriate sample configuration file from /usr/local/shared/mysql to become /usr/local/etc/my.cnf. Then please edit /usr/local/etc/my.cnf and add following lines in their corresponding sections:
[client]
default-character-set = utf8
[mysqld]
# Comment this line out if you don't want to use InnoDB as the default engine.
default-storage-engine = innodb
default-character-set = utf8
default-collation = utf8_general_ci
You must also uncomment those lines begins with innodb_ when InnoDB is set to be the default database engine.
To enable MySQL to start at system boot-up, do this
# echo mysql_enable=\"YES\" >> /etc/rc.conf
MySQL server can be started manually with the command:
# service mysql-server start
Don't forget to set MySQL's root user password:
# mysqladmin -u root password <password you want>
Of course, you will enter your own desired password in place of <password you want>.