===========
Install freebsd in mysql
===========

cd /usr/ports/databases/mysql50-server
make install clean
mysql_install_db –user=mysql
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe -user=mysql &

Note: If you encounter Command not found error, use command rehash to update OS path environment variables.
# The port installation will put a script file mysql-server.sh in /usr/local/etc/rc.d which will has capability to start MySQL server. To enable MySQL server to start automatically after every FreeBSD server reboot
, enter the following command in CLI:

echo ‘mysql_enable=”YES”‘ >> /etc/ rc.conf
# By default, MySQL default super user account – root – has no password (blank password). So it’s important to assign the administrator account password. To change the password to root user, enter the following command:

mysqladmin -u root password newpassword

Replace newpassword with your own desired password.
# Optionally, copy either my-huge.cnf, my-large.cnf, my-medim.cnf, my-small.cnf or my-innodb-heavy-4G.cnf (depending on the usage and utilization of MySQL server) as my.cnf to /var/db/mysql which will enable you to tweak and change the configuration of server-specific MySQL server options by editing the file.
# MySQL 5.0 installation done.

FreeBSD does not automatically include a default my.cnf for MySQL. Instead, a set of sample configuration files can be found under /usr/local/share/mysql. These configuration files include my-small.cnf, my-medium.cnf, my-large.cnf, my-innodb-heavy-4G, and my-huge.cnf. The appropriate file can be copied and used as a template configuration by performing the following actions:

cd /usr/local/share/mysql/
cp /usr/local/share/mysq/mysql-large.cnf /usr/local/etc/my.cnf
/usr/local/etc/rc.d/mysql-server restart

Configure to Start on Boot
A startup script is installed in the usual location, /usr/local/etc/rc.d/. Before this startup script will function, you need to open your /etc/rc.conf and add the line mysql_enable=”YES”.

Start MySQL
MySQL is now configured to start at boot, but you probably don’t want to reboot just to get it to start. Just run the following.

/usr/local/etc/rc.d/mysql-server.sh start

Now MySQL is running and ready for use.