標籤:mysql的安裝
分類: Mysql/postgreSQL
CentOS6.3源碼安裝mysql-5.5.27
#mysql5.5以上使用cmake代替configure編譯,首先需要安裝cmake
yum install cmake
# 建mysql使用者和組
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# 解壓tgz包,編譯mysql
shell> tar zxvf mysql-5.5.27.src.tar.gz
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報如下錯誤:
==================================================
[[email protected] 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
這個我也不知道為啥
-- Performing Test HAVE_PEERCRED - Success
-- Looking for include files HAVE_PAM_APPL_H
-- Looking for include files HAVE_PAM_APPL_H - not found.
-- Looking for strndup
-- Looking for strndup - found
-- Looking for event.h
-- Looking for event.h - not found
-- Configuring incomplete, errors occurred!
[[email protected] mariadb-10.0.12]# make
make: *** No targets specified and no makefile found. Stop.
這個我也不會。。你百度看看把
本文出自 “Regex和fgrep” 部落格,請務必保留此出處http://9025736.blog.51cto.com/9015736/1545814
mysql的安裝