2011年7月27日 星期三

在Fedora 上手動安裝 MySQL (using source code to install)

首先到Mysql (http://dev.mysql.com/downloads/mysql/)網站上抓取MySQL Community Server , 下載 .tar 封裝的source code.

Step 1. 解壓縮
tar zxvf mysql-5.5.9.tar.gz

Step 2.
groupadd mysql

Step 3.
useradd -g mysql -c "MySQL Server" mysql

Step4.
cd /usr/local/src/mysql-x.x.xx

Step5.
chown -R root.root *

Step6.
make clean

Step7.
./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --disable-maintainer-mode --with-mysqld-user=mysql --with-unix-socket-path=/tmp/mysql.sock --without-comment --without-debug --without-bench

Step8.
make && make install

Step9.
cd /usr/local/mysql

Step10.
./scripts/mysql_install_db

Step11.
chown -R root:mysql /usr/local/mysql

Step12.
chown -R mysql:mysql /usr/local/mysql/data

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

Step14.
chown root:sys /etc/my.cnf

Step15.
chmod 644 /etc/my.cnf

Step16.
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf

Step17.
ldconfig

Step18.
cp ./support-files/mysql.server /etc/rc.d/init.d/mysql

Step19.
chmod +x /etc/rc.d/init.d/mysql

Step20.
/sbin/chkconfig --level 3 mysql on

Step21.
cd /usr/local/mysql/bin

Step22.
for file in *; do ln -s /usr/local/mysql/bin/$file /usr/bin/$file; done

Step23.
vi /etc/my.cnf uncomment
skip-networking

Step24.
cd /usr/local/mysql/support-files/

Step25.
chmod 777 mysql.server

Step26.
/usr/local/mysql/bin/mysqld_safe --user=mysql &

Step27.
/usr/local/mysql/bin/mysqladmin -u root –p password
更改root 密碼, default 密碼直接按Enter
然後再輸入自訂密碼, 及確認自訂密碼

Step28.
MySQL 開機自動啟動;
vi /etc/rc.d/rc.local
加上 /usr/local/mysql/support-files/mysql.server start

Step29.
Done.

沒有留言: