1.安装必要的库文件
yum install -y gcc*
2.yum安装camke
yum install -y cmake
编译安装cmake
cd /usr/local/src
wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
./configure
make
make install
3.安装 MYSQL
cd /usr/local/src
groupadd mysql
useradd -g mysql -M -s /sbin/nologin mysql
tar zxf mysql-5.6.29.tar.gz
cd mysql-5.6.29
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1
make && make install
cd /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
./scripts/mysql_install_db --user=mysql -datadir=/data/mysql
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
bin/mysqld_safe --user=mysql &
/etc/init.d/mysqld start
错误1:-- Could NOT find Git (missing: GIT_EXECUTABLE)
-- 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.
解决:
-- Could NOT find Git (missing: GIT_EXECUTABLE)这项应该缺少git包,yum install -y git
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown 这两项缺少gcc和gcc-c++的包,yum install -y gcc gcc-c++
错误2:-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:85 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:128 (FIND_CURSES)
cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:409 (MYSQL_CHECK_EDITLINE)
-- Configuring incomplete, errors occurred!
解决:-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
缺少ncurses-devel包,yum install -y ncurses-devel
删除CMakeCache.txt
file=find / -name CMakeCache.txt
rm -f $file
错误3:Warning: Bison executable not found in PATH
解决:
Warning: Bison executable not found in PATH 缺少Bison,yum install -y bison