Compiling MySQL 5 from source on FreeBSD 7

source http://blog.bigboylemonade.com/2007/11/24/installing-mysql-5-from-source-on-freebsd-6/
http://dev.mysql.com/doc/refman/5.1/en/freebsd.html
————————————————————————————————————
This is a quick simple guide how to compile mysql-5.0.67 from source on FreeBSD 7.0

First we need to download the source file from

# cd /usr/local/src
# wget -c http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67.tar.gz/from/http://mysql.mirror.redwire.net/
# tar xvfz mysql-5.0.67.tar.gz
# cd mysql-5.0.67

Pastikan bahwa menggunakan Bash SHELL
# CC=gcc CFLAGS=”-O2 -fno-strength-reduce” CXX=gcc CXXFLAGS=”-O2 -fno-rtti -fno-exceptions -felide-constructors -fno-strength-reduce”
# ./configure –prefix=/usr/local/mysql –enable-assembler

Then we compile using gmake
Klo gmakenya not found, maka harus diinstall terlebih dahulu di sysinstall

# gmake

Once compiled correctly with no errors we need to gmake install

# gmake install

Once this has been compiled correctly we now need to create a MySQL user.

First we use pw to add the mysql group.

# pw groupadd mysql

Then we create the MySQL user, add the user to the MySQL group and disable shell access.

# pw useradd mysql -g mysql -s /usr/sbin/nologin

Then we lock the account out for security purposes.

# pw lock mysql

Then inside the source directory we need to copy the my.cnf to the /etc directory to tune the different option we may want.

# cp support-files/my-medium.cnf /etc/my.cnf

Now we sort out the permissions and create the initial databases.

# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
# bin/mysql_install_db –user=mysql
# chown -R root .
# chown -R mysql var

Now that is all done we are ready to start MySQL for the first time.

# bin/mysqld_safe –user=mysql &

To finalise the installation we just need to set a MySQL root password to secure the database service.

# /usr/local/mysql/bin/mysqladmin -u root password ‘new-password’

And we are done!

To start MySQL at anytime simply issue the command

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

If you would like to start MySQL when FreeBSD starts simply add a line to your /etc/rc.local file.

# echo “/usr/local/mysql/bin/mysqld_safe –user=mysql &” >> /etc/rc.local

Untuk tweaknya bisa menambahkan isian berikut pada /boot/loader.conf.
kern.maxdsiz=”1073741824″ # 1GB
kern.dfldsiz=”1073741824″ # 1GB
kern.maxssiz=”134217728″ # 128MB

Aturrr dahhhh

Iklan
Ditulis dalam Tutorial. 2 Comments »

2 Tanggapan to “Compiling MySQL 5 from source on FreeBSD 7”

  1. Joey Says:

    om…
    kalo atur database pvpgn pake mysql di windows gmn???

    • hanadi Says:

      tinggal arahin ajah difile konfigurasi bnet nya supaya baca ke mysql windows nya ..
      blom pernah coba sih .. tapi logikannya sih seperti itu


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: