源碼編譯mysql5.5過程記錄

官網安裝教程:html

http://dev.mysql.com/doc/refman/5.5/en/installing-source-distribution.htmlmysql


CentOS6.3源碼安裝mysql-5.5.27c++

#mysql5.5以上使用cmake代替configure編譯,首先須要安裝cmakesql

yum install cmakeshell

# 建mysql用戶和組數據庫

shell> groupadd mysqlide

shell> useradd -r -g mysql mysql.net

# 解壓tgz包,編譯mysqlserver

shell> tar zxvf mysql-5.5.27.src.tar.gzhtm

shell> cd mysql-5.5.27

shell> cmake .

shell> make && make install

# 編譯結束

# 更改用戶和組屬性,執行mysql_install_db初始化數據庫

shell> cd /usr/local/mysql

shell> chown -R mysql:mysql .

shell> scripts/mysql_install_db --user=mysql

shell> chown -R root .

shell> chown -R mysql data

# (如下命令可選)拷貝配置文件到/etc目錄下,啓動mysql

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> bin/mysqld_safe --user=mysql &

# (如下命令可選)設置mysql開機自啓動

shell> cp support-files/mysql.server /etc/init.d/mysql.server

安裝過程並不順利,遇到好幾回錯誤

1.沒有安裝 gcc 和 gcc-c++,執行cmake報以下錯誤:

==================================================

[root@ice  mysql-5.5.27]# cmake .

-- The C compiler identification is unknown

-- The CXX compiler identification is unknown

CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.

CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

.

.

.

-- Configuring incomplete, errors occurred!

==================================================

解決方法:安裝gcc和gcc-c++

yum install gcc

yum install gcc-c++

#刪除cache文件,不刪除還會報錯

rm CMakeCache.txt 

cmake .

2.編譯快結束時,又報以下錯誤:

Warning: Bison executable not found in PATH

解決方法:安裝bison

yum install bison

rm CMakeCache.txt 

cmake .

#編譯經過

make && make install

#執行時間比較長

3.沒法啓動mysql

bin/mysqld_safe --user=mysql & 沒法啓動

解決方法:

再執行一次scripts/mysql_install_db --user=mysql

爲何會這樣,緣由不明

相關文章
相關標籤/搜索