Thursday, March 15, 2012

Installing Mysql 5.1 on FreeBSD

Now its turn for configuring MySQL

We all aware of Mysql and a lot of times it is the first things we install on a server. I recently tried it on my FreeBSD server and it went well.
You can install mysql from the FreeBSD Ports Collection.

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

Then you will have to wait until the package builds itself from source.
* please wait it will take some time to complete...refresh  your eyes...have a chat with your friend...:)-
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/
chown changes the user and/or group ownership of each given file, according to its first non-option argument, which is interpreted as follows. If only a user name (or numeric user ID) is given, that user is made the owner of each given file, and the files' group is not changed. If the user name is followed by a colon or dot and a group name (or numeric group ID), with no spaces between them, the group ownership of the files is changed as well. If a colon or dot but no group name follows the user name, that user is made the owner of the files and the group of the files is changed to that user's login group. If the colon or dot and group are given, but the user name is omitted, only the group of the files is changed; in this case,chownperforms the same function aschgrp.

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.

vi /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.

No comments:

Post a Comment