blog.up-link.ro
3Mar/100

MySQL Server Installation in FreeBSD using ports

This guide describes how to install MySQL, a very popular relational database, in FreeBSD.

Please make sure the ports collection is up to date. If not, run the following command:
# portsnap fetch update

Then navigate to the ports folder for MySQL:
# cd /usr/ports/databases/mysql51-server
and run:
# make install clean
This command will download required files from the internet and will install MySQL server.

Once the install is finished, we install the database
# mysql_install_db --user=mysql
and we set up the directory permissions
# chown -R mysql /var/db/mysql/
# chgrp -R mysql /var/db/mysql/

Make sure MySQL server start automatically whenever FreeBSD comes up after reboot.
FreeBSD provide this facility via system configuration information. This file lists which services should be started up at system initial boot time.
The file contains the global system configuration information referenced by the start up scripts and is stored in /etc/rc.conf.

Configure FreeBSD to start MySQL at start up
Open /etc/rc.conf file using a text editor ( I use vi but you can use your preferred editor )
# vi /etc/rc.conf
and append following line which will enable MySQL server automatically after each reboot:
mysql_enable="YES"
Save file and exit to shell prompt.

Starting MySQL server
To Start MySQL server under FreeBSD type following command (use script):
# /usr/local/etc/rc.d/mysql-server.sh start

Note: This will work only if you have mysql_enable="YES" in rc.conf. If you don't, use the following command:
# /usr/local/etc/rc.d/mysql-server.sh forcestart

MySQL Password
By default, MySQL super user account has no password. So it’s important to assign the administrator account password. To change the root password, enter the following command:
mysqladmin -u root password newpass

Replace newpass with your own desired password.

Optionally, copy either my-huge.cnf, my-large.cnf, my-medim.cnf or my-small.cnf  (depending on the usage and utilization of your MySQL server) as my.cnf to /etc/ or /var/db/mysql which will enable you to tweak and change the configuration of server-specific MySQL server options by editing the file.

Print This Post Print This Post
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


*

No trackbacks yet.