Installing Mysql 5.1 on FreeBSD 7.0

Last updated: Jun 12, 2008

Well we all love Mysql and a lot of times it is the first things we install on a server. I recently installed it on my FreeBSD 7.0 server and it went pretty smooth. You can install mysql from the FreeBSD Ports Collection.

BSD and Mysql

cd /usr/ports/databases/mysql51-server make install clean

Then you will have to wait until the package builds itself from source. This may take some time so feel free to browse around the rest of the blog or grab a bite to eat.

Once that is done you will want to use mysql’s install script to get you up and running:

/usr/local/bin/mysql_install_db

Make the mysql directory owned by the user, ‘mysql’.

chown -R mysql /var/db/mysql/ chgrp -R mysql /var/db/mysql/

Run mysql as the ‘mysql’ user.

/usr/local/bin/mysqld_safe –user=mysql

Then you will want to set the Mysql root password:

/usr/local/bin/mysqladmin -u root password YoUrPaSSwoRd

Start Mysql on Boot

You will probably want Mysql to start on boot. To enable Mysql on boot you will need to add a line to your rc.conf file. I used my favorite text editor vim to edit it.

vim /etc/rc.conf

Then add the following lines near the bottom:

# Enable Mysql mysql_enable="YES"

Thats it! You should have a working installation of mysql and have it configured to load up on boot.

Need to print shipping labels on your site?

Checkout my product RocketShipIt for simple easy-to-use developer tools for UPS™ FedEx™ USPS™ and more.

Get notified on new posts or other things I'm working on

Share: