Ubuntu 10.10 源碼安裝MySQL 5.1.34 |
發(fā)布時間: 2012/8/17 17:33:04 |
最近將系統(tǒng)重新安裝了Ubuntu 10.10系統(tǒng),需要重新編譯安裝Mysql,源碼版本是5.1.34 很折騰,不知道10.10的系統(tǒng)改了些什么東西,裝軟件都這么不順利 在這里把發(fā)生的問題都記錄一下: 步驟如下: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1. 安裝Ubuntu 10.10下的編譯工具 sudo apt-get install build-essentials 安裝后gcc 和 g++ 的版本都是 (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2. ./configure --prefix=/usr/local/mysql ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3. make 在make時出錯,最后幾行如下: make[2]: *** [do_abi_check] Error 1 make[2]: Leaving directory `/home/ice/Documents/software/mysql/src/mysql-5.1.34' make[1]: *** [abi_check] Error 2 make[1]: Leaving directory `/home/ice/Documents/software/mysql/src/mysql-5.1.34' make: *** [all-recursive] Error 1 參照 http://bugs.mysql.com/bug.php?id=52514 中對此問題的說明,將Makefile中最后面的do_abi_check注釋掉 跳過ABI Check 重新make成功 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4. sudo make install 順利通過 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5. 到目錄/usr/local/mysql下執(zhí)行如下命令 (ice是我的用戶名)
chgrp -R ice . ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6. 到目錄/usr/local/bin 下 運行mysql_install_db --basedir=/usr/local/mysql \ --datadir=/usr/local/mysql/data ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7. 切到目錄libexec下 ------------------------------------------------------- 執(zhí)行命令 ./mysqld 產生如下錯誤 101215 10:09:07 [ERROR] Can't find messagefile '/usr/share/mysql/english/errmsg.sys' 問題的原因,應該是自己沒有定義一個my.cnf配置文件,如果不給自己的配置文件,系統(tǒng)就會用默認的配置,然后就會產生上面的錯誤 將源碼中的 support_files 文件夾下的 my_small.cnf 復制到 /etc/my.cnf下,并增加一個參數 language = /usr/local/mysql/share/mysql/english -------------------------------------------------------- 運行 ./mysqld 還有錯: 101215 2:25:47 [Warning] Can't create test file /var/lib/mysql/ice-ThinkPad-R400.lower-test 101215 2:25:47 [Warning] Can't create test file /var/lib/mysql/ice-ThinkPad-R400.lower-test ./mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2) 101215 2:25:47 [ERROR] Aborting 101215 2:25:47 [Note] ./mysqld: Shutdown complete 未找到原因,查閱官方文檔http://dev.mysql.com/doc/refman/5.1/en/starting-server.html 發(fā)現中間有這么一句話: When the mysqld server starts, it changes location to the data directory. 所以估計上面的錯誤是因為沒有指定datadir參數,系統(tǒng)默認數據文件夾是在 /var/lib/mysql/ 的原故吧 再一次運行命令 ./mysqld --datadir=/usr/local/mysql/data 上面的錯誤沒有了 將這個參數也加到 /etc/my.cnf 配置文件中 -------------------------------------------------------- 運行 ./mysqld 發(fā)生如下錯誤 101215 11:12:31 [ERROR] Can't start server : Bind on unix socket: No such file or directory 101215 11:12:31 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ? 101215 11:12:31 [ERROR] Aborting 糾結,怎么不斷的有錯誤,繼續(xù)在網上搜索終于找到了問題的根源所在 在Ubuntu下,還有一個這樣的配置文件 /etc/mysql/my.cnf 文件中有下面幾行: user= mysql socket= /var/run/mysqld/mysqld.sock port= 3306 basedir= /usr datadir= /var/lib/mysql tmpdir= /tmp 這個配置文件是系統(tǒng)自己帶的,原來上面好多問題都是這個隱藏的配置文件在搞鬼,唉,折騰了好長時間,終于找到問題根源了! 將/etc/mysql/my.cnf 改為 /etc/mysql/my.cnf.backup 再次運行 ./mysqld 101215 11:54:11 [Note] Event Scheduler: Loaded 0 events 101215 11:54:11 [Note] ./mysqld: ready for connections. Version: '5.1.34' socket: '/tmp/mysql.sock' port: 3306 Source distribution ready for connections 終于成功了! 祝賀一下自己! ----------------------------------------------------------------- 注:這兩天又查了一些資料發(fā)現出現這么多問題的原因是由于gcc4.3升級到gcc4.4版本的改動,用gcc4.4編譯,不僅ABI_CHECK出現問題,安裝后執(zhí)行mysql自帶的測試時還有一些測試通不過,將編譯器降為gcc4.3和g++4.3后,源碼安裝過程中就不會出現ABI_CHECK不通過的問題,編譯成功后能通過所有的測試 本文出自:億恩科技【mszdt.com】 |