一、編譯 MySQL5.0
# ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --enable-thread-safe-client --enable-local-infile --enable-assembler --enable-community-features --enable-profiling --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-mysqld-user=mysql --without-embedded-server --with-big-tables --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/etc/mysql.sock --without-debug --without-man --without-docs --without-bench --with-csv-storage-engine --with-blackhole-storage-engine --with-federated-storage-engine
編譯完成后的配置(其它版本的操作類似)
# cd /usr/local/mysql
# cp share/mysql/my-medium.cnf /etc/my.cnf
# mkdir etc
安裝數(shù)據(jù)庫文件
# ./bin/mysqld_install_db
# chown -R mysql:mysql .
# ./bin/mysqld_safe --user=mysql &
二、編譯 MySQL5.1
# ./configure --prefix=/usr/local/mysql5.1 --localstatedir=/usr/local/mysql5.1/data --enable-thread-safe-client --enable-local-infile --enable-assembler --enable-community-features --enable-profiling --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-mysqld-user=mysql --without-embedded-server --with-big-tables --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/etc/mysql.sock --without-debug --without-man --without-docs --with-plugins=partition,blackhole,csv,federated,heap,innobase,myisam
編譯 innodb_plugin 需要升級 gcc 版本
# export CFLAGS="-O2 -DHAVE_DLOPEN=1"
# export CXXFLAGS="-O2 -DHAVE_DLOPEN=1"
# ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --enable-thread-safe-client --enable-local-infile --enable-assembler --enable-community-features --enable-profiling --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-mysqld-user=mysql --without-embedded-server --with-big-tables --with-server-suffix=-community --with-unix-socket-path=/usr/local/mysql/etc/mysql.sock --without-debug --without-man --without-docs --with-plugins=partition,blackhole,csv,federated,heap,innobase,innodb_plugin,myisam --disable-static
使用 innodb_plugin 需要編輯配置文件 my.cnf 增加如下內(nèi)容:
#禁用舊的 innodb
ignore_builtin_innodb
# 啟用 innodb plugin
plugin_load=innodb=ha_innodb_plugin.so
# 設(shè)置新的數(shù)據(jù)文件格式,支持表數(shù)據(jù)和索引的壓縮
innodb_file_format=barracuda
# 使用獨立的表空間
innodb_file_per_table
# 嚴格的檢查模式
innodb_strict_mode=1
三、編譯 MySQL5.5
MySQL5.5 版本使用了CMake來編譯,它是跨平臺的編譯工具
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/usr/local/mysql/etc -DDEFAULT_CHARSET=utf8 -DMYSQL_UNIX_ADDR=/usr/local/mysql/etc/mysql.sock 本文出自:億恩科技【1tcdy.com】
服務(wù)器租用/服務(wù)器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|