01. 下載 mysql-5.5.17.tar.gz source code
02. 解壓縮 tar zxfv mysql-5.5.17.tar.gz
03. 到 www.cmake.org 下載 cmake-2.8.6.tar.gz
04. 安裝 cmake
shell> ./configure --prefix=/usr/local/cmake
shell> make && make install
-----------------------------------------------------------------------------------------------------------
05. 安裝 ncurses-devel (libncurses5-dev)
shell> yum -y install ncurses-devel
-----------------------------------------------------------------------------------------------------------
06. 安裝openssl-devel
shell> yum -y install openssl-devel
-----------------------------------------------------------------------------------------------------------
07. 如果有發生錯誤,修正完後,記得刪除mysql-5.5.17下面的CMakeCache.txt,然後重新cmake
-----------------------------------------------------------------------------------------------------------
08. patch檔,可以除存成 my_mysql_install.sh
#!/bin/bash
cd ./mysql-5.5.17
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DWITH_SSL=bundled \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0
exit 0
-----------------------------------------------------------------------------------------------------------
09. shell> ./my_mysql_install.sh
10. shell> cd my_sql-5.5.17
11. shell> make && make install
12. sehll> cp /usr/local/mysql/support-files/mysql.server /usr/local/mysql/bin
13. shell> groupadd mysql
14. shell> useradd –r –g mysql mysql
15. shell> cd /usr/local/mysql
16. shell> chown –R mysql .
17. shell> chgrp –R mysql .
18. shell> scripts/mysql_install_db --user=mysql &
19. shell> chown –R root .
20. shell> chown –R mysql data
21. shell> cp support-files/my-medium.cnf /etc/my.cnf
22. shell> bin/mysqld_safe –-user=mysql &
23. 如果 "步驟22." 發生錯誤,則
shell> mysql.server start
參考文章
01. centos cmake安裝mysql-5.5.16附配置文件
02. Linux下MySQL 5.5.8源碼編譯安裝記錄
03. Linux下源碼編譯MySQL 5.5與安裝過程全記錄
04. Basic installation of MySQL from source
05. linux cmake 安裝mysql-5.5.11,以及更高版本