查看官网安装说明:

http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html

一、编译安装

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

二、cmake过程报错说明及解决:

1、curses报错:

-- Could NOT find OpenSSL (missing: OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)  
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)  
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found. Please install appropriate package,

解决方法: yum install ncurses-devel


2、HAVE_PEERCRED报错:

-- Performing Test HAVE_PEERCRED
CMake Error at /usr/share/cmake/Modules/CMakeCXXInformation.cmake:17 (GET_FILENAME_COMPONENT):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:3 (PROJECT)

解决方法:yum install gcc gcc-c++ -y


3、bison报错:

-- Googlemock was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
Warning: Bison executable not found in PATH
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl


解决方法:yum install -y libaio bison


之后清理缓存文件,然后重新编译:

rm -f CMakeCache.txt
cmake .