源碼編譯 MySQL 5.0.45
資料來源:http://hi.baidu.com/chinaw3/item/0bd472ba15fc19eb4fc7fd37
[ 源碼編譯 MySQL 5.0.45 ]
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar xzf mysql-5.0.45.tar.gz
shell> cd mysql-5.0.45
shell> CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql \
--enable-assembler \
--enable-local-infile \
--with-pthread \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static
--prefix=/usr/local/mysql \
--enable-assembler \
--enable-local-infile \
--with-pthread \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=root
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=root &
======================.
CFLAGS="-O3"
-O (-O1), -O0, -O2, -O3, -Os
依照後面數字的大小,針對效能最佳化的程度也不同 (穩定度也可能遞減)。其中 -Os 是個比較特殊的等級,針對原始碼大小最佳化。
可使用 -Os,降低程序加載的時間。
依照後面數字的大小,針對效能最佳化的程度也不同 (穩定度也可能遞減)。其中 -Os 是個比較特殊的等級,針對原始碼大小最佳化。
可使用 -Os,降低程序加載的時間。
=============================
FreeBSD 6.3 下編譯 MySQL4.0.27
=============================
FreeBSD 6.3 下編譯 MySQL4.0.27
=============================
./configure --prefix=/usr/local/mysql --enable-shared --enable-static --enable-thread-safe-client --enable-assembler --enable-local-infile --with-pthread --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-low-memory --with-vio --with-charset=gb2312 --with-extra-charsets=all --with-big-tables CFLAGS="-pipe -march=i686 -fno-omit-frame-pointer -O3" CXXFLAGS="-pipe -march=i686 -fno-omit-frame-pointer -O3 -felide-constructors -fno-rtti -fno-exceptions"
註:如果出現 configure: error: cannot compute sizeof (int), 77 錯誤。
是with-named-thread-libs 參數不對,可以取消這個參數。先跳過這個錯誤。