許多 CentOS 5 用戶因特殊需求仍需安裝 MySQL 4.0.27,但首次編譯常遇多個問題。完整記錄安裝過程及解決方案供參考。
下載 mysql-4.0.27.tar.gz,解壓後進入目錄準備編譯。
編譯出現 checking "LinuxThreads..." Not found,因 NPTL 與 LinuxThreads 差異。解決:在 /usr/include/pthread.h 加入標註:
echo '/* Linuxthreads */' >> /usr/include/pthread.h
編譯時加入參數 --with-pthread 及 --with-named-thread-lib。
重新編譯出現 configure: error: No curses/termcap library found,因系統未裝 ncurses 開發套件:
yum install ncurses-devel
安裝完成後繼續編譯。
編譯出現 cannot find -lreadline,需安裝 readline 開發套件:
yum install readline-devel
安裝後重新執行配置指令:
./configure --with-pthread --with-named-thread-lib=-lpthread
完成上述步驟即可成功編譯安裝 MySQL 4.0.27。