MySQL 編譯引數說明

2021-08-25 19:08:25 字數 2868 閱讀 1057

[quote]/usr/sbin/groupadd mysql

/usr/sbin/useradd -g mysql mysql

tar zxvf mysql-5.4.0-beta.tar.gz

cd mysql-5.4.0-beta

cflags="-o6 -mpentiumpro -fomit-frame-pointer" cxx=gcc cxxflags="-o6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"

./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/var/ --with-server-suffix=-enterprise-gpl --without-debug --with-big-tables --with-extra-charsets=latin1,gb2312,big5,utf8,gbk --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug --without-isam --with-federated-storage-engine

make && make install

cp support-files/my-medium.cnf /usr/local/mysql/my.cnf

/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql[/quote]

my.cnf檔案記得登出--skip-federated引擎功能再啟動mysql

./mysqld_safe --defaults-file=/usr/local/mysql/my.cnf --user=mysql &

mysql編譯引數說明:根據 ./configure --help 檢視支援配置的引數

-pgcc和-o6編譯

cflags="-o6 -mpentiumpro -fomit-frame-pointer" cxx=gcc cxxflags="-o6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"

總體效能可提高10%,當然如果伺服器不是用奔騰處理器,就不必用它了,因為它是專為奔騰系統設計的

-static靜態編譯

--enable-static

--with-client-ldflags=-all-static

--with-mysqld-ldflags=-all-static

以靜態方式編譯客戶端和服務端,能提高13%效能

--enable-thread-safe-client

以執行緒方式編譯客戶端

--without-innodb

去掉innodb表支援,innodb是一種支援事務處理的表,適合企業級應用

--without-isam

去掉isam表型別支援,現在很少用了,isam表是一種依賴平台的表

--without-ndb-debug

取消導航除錯

--localstatedir=/usr/local/mysql/var/

日誌檔案目錄

--with-server-suffix=-enterprise-gpl

給mysql加個字尾名,在用mysql登入的時候在版本號的後面可以看到

--without-debug

去除診斷模式,如果用--with-debug=full編譯,大多數查詢慢20%

--with-big-tables

大表支援

--with-extra-charsers=gbk,gb2312,utf8

設定支援gbk,gb2312,utf8字符集

--with-pthread

強制使用pthread庫(posix執行緒庫)

--enable-assembler

使用一些字元函式來彙編版本

--with-federated-storage-engine

這個引數已經被廢除,代替它的是--with-plugin系列

cp support-files/my-medium.cnf /usr/local/mysql/my.cnf

mysql/support-files裡面有配置檔案範本,根據實際情況選擇或者更改

/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --defaults-file=/usr/local/mysql/my.cnf --pid-file=/usr/local/mysql/mysql.pid

設定預設值:預設空間路徑;預設資料檔案路徑;預設使用者;預設配置檔案路徑;預設pid檔案路徑。

本腳步未加入的編譯引數:

--with-charset=utf8

設定預設字符集

--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock

使用unix套接字鏈結提高7.5%效能,所以在windows下mysql效能肯定不如 unix

--with-tcp-port=3306

指定mysql例項將監聽tcp 3306埠

QT編譯引數說明

注 本文的例子都基於qt embedded linux opensource src 4.5.x 當進入解壓好的原始碼包後,使用.configure help命令,可以獲得相應幫助 如果引數前面有 號,直接配置編譯的話,就會把這些引數預設進去。為了便於分析,接下來,我們以如下格式進行 引數解釋 re...

gcc常用編譯引數說明

gcc編譯引數 g 為了gdb除錯使用,預設加上有利於後期直接定位coredump o2 優化選項 o0 o1 o2 o3 o0 不進行優化處理。o 或 o1 優化生成 o2 進一步優化。o3 比 o2 更進一步優化,包括 inline 函式 pipe 使用管道代替編譯中臨時檔案,加速編譯 wall...

mysql 幾個引數說明

table cache 表快取大小,即可以快取開啟表的個數。每個查詢請求到mysql server後,會開啟表 然後掃瞄資料 有了表快取後會把開啟的表快取起來下次使用 key buffer size 索引快取 只對myisam表有效,快取表索引 query cache size 查詢快取 類似hib...