Blue Flower

Installing the MySql Database Server

Installing Mysql

MySQL is a very fast, multi-threaded, multi-user and robust SQL (Structured Query Language) database server. For more information (Mysql has VERY good documentation I might add) please check out

All we need to do are a few things. Lets get Mysql installed first. This will install both the client and the server automatically.

# cd /usr/ports/databases/mysql56-server
# make install clean

Configuring mysql

We now need to tell Mysql to come up on startup. To do this, we need to add mysql_enable="YES" to /etc/rc.conf. So lets go ahead and edit /etc/rc.conf and add it!

# echo 'mysql_enable="YES"' >> /etc/rc.conf

Manually starting Mysql

Run the following command to start mysql:

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

You will then see Starting mysql. and then it will drop to the next line. See if it's running by using the following command:

# ps -auxw | grep mysql

and you should see something like:

mysql 35843 0.0 0.4 1644 1132 p0 I 10:27PM 0:00.03 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mys
mysql 35861 0.0 10.6 55544 26852 p0 S 10:27PM 0:01.50 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf

Don't worry if you see it cutoff at the end of the first line. This is completely normal. These 2 lines are just telling us mysql is running fine! Mysql is installed and configured!

Now to set the correct users:

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

To ensure the security of the default settings of MySQL, continue with the command below:

# mysql_secure_installation

When prompt with “Enter current password for root” hit enter for none then Y(Yes) to set MYSQL password. You will then be prompted with a series of questions. Just type Y for yes on all of them, see the screen shot below: