源码编译安装5.6.10

[root@localhost ~]# tar xf mysql-5.6.10.tar.gz
[root@localhost ~]# cd mysql-5.6.10

[root@localhost mysql-5.6.10]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDWITH_EXTRA_CHARSETS:STRING=all
-bash: cmake: command not found

[root@localhost mysql-5.6.10]#yum -y install cmake

[root@localhost mysql-5.6.10]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDWITH_EXTRA_CHARSETS:STRING=all
-- Running cmake version 2.6.4
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:/root/mysql-5.6.10/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:/root/mysql-5.6.10/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

yum -y install gcc gcc-c++

Complete!
[root@localhost mysql-5.6.10]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDWITH_EXTRA_CHARSETS:STRING=all
-- Running cmake version 2.6.4
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:/root/mysql-5.6.10/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:/root/mysql-5.6.10/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

上述问题时因为没有安装make

yum -y install make

安装后make 再次编译

-- 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,

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:126 (FIND_CURSES)
cmake/readline.cmake:193 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:325 (MYSQL_CHECK_READLINE)


-- Configuring incomplete, errors occurred!

yum -y install ncurses-devel

[root@localhost mysql-5.6.10]# yum -y install ncurses-devel
[root@localhost mysql-5.6.10]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDWITH_EXTRA_CHARSETS:STRING=all
-- Running cmake version 2.6.4
-- MySQL 5.6.10
-- Packaging as: mysql-5.6.10-Linux-i686
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- 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,

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:126 (FIND_CURSES)
cmake/readline.cmake:193 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:325 (MYSQL_CHECK_READLINE)


-- Configuring incomplete, errors occurred!
[root@localhost mysql-5.6.10]# yum -y install libncurses5-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Setting up Install Process

移除CMakeCache.txt,重新编译

[root@localhost mysql-5.6.10]# service mysqld start
mysqld: unrecognized service
[root@localhost mysql-5.6.10]# find / -name mysqld_install_db
[root@localhost mysql-5.6.10]# find / -name mysql_install_db
/root/mysql-5.6.10/scripts/mysql_install_db
[root@localhost mysql-5.6.10]# /root/mysql-5.6.10/scripts/mysql_install_db --user=mysql
-bash: /root/mysql-5.6.10/scripts/mysql_install_db: Permission denied
[root@localhost mysql-5.6.10]# scripts/mysql_install_db --user=mysql
-bash: scripts/mysql_install_db: Permission denied
[root@localhost mysql-5.6.10]# ls -al scripts/mysql_install_db
-rw-r--r--. 1 root root 32588 Sep 18 05:26 scripts/mysql_install_db
[root@localhost mysql-5.6.10]# chmod +x scripts/mysql_install_db
[root@localhost mysql-5.6.10]# ls -al scripts/mysql_install_db
-rwxr-xr-x. 1 root root 32588 Sep 18 05:26 scripts/mysql_install_db
[root@localhost mysql-5.6.10]# scripts/mysql_install_db --user=mysql
-bash: scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory
[root@localhost mysql-5.6.10]#make install

cp support-files/mysql.server /etc/init.d/mysqld

 

原文地址:https://www.cnblogs.com/seasonsstory/p/3570895.html