1. 安装好--安装MySQL需要的包 yum install -y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison ncurses5-devel 2. [root@localhost ~]# cd /usr/local/src //下载MySQL源码包 [root@localhost src]# wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33.tar.gz [root@localhost src]# ls mysql-5.6.33.tar.gz [root@localhost src]# tar zxvf mysql-5.6.33.tar.gz [root@localhost src]# cd mysql-5.6.33 第一步: [root@localhost mysql-5.6.33]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_engine=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1 //此为安装成功信息 ...... -- 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 -- Configuring done -- Generating done -- Build files have been written to: /u01/mysql-5.6.33 第二步: [root@localhost mysql-5.6.33]# make //此为安装成功信息 ...... Scanning dependencies of target mysqltest_embedded [ 99%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o Linking CXX executable mysqltest_embedded [ 99%] Built target mysqltest_embedded Scanning dependencies of target my_safe_process [100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o Linking CXX executable my_safe_process [100%] Built target my_safe_process 第三步: [root@localhost mysql-5.6.33]# make install 然后的做法跟着LAMP的步骤走
此处会出现的错误!!!!
CMake Error: The source directory "/usr/local" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. --> /* 进入解压后的MySQL目录查看是否有CMakeLists.txt文件 如果没有,则需要重新下载一个MySQL文件才可以。 http://dev.mysql.com/downloads/mysql/5.6.html#downloads -- 选择SOURCE CODE -- 再看哪个版本,(一般是最后那一个) */
出现以下错误提示: -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:82 (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:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:250 (MYSQL_CHECK_READLINE) 解决方法: [root@localhost mysql-5.5.11]# rm CMakeCache.txt [root@localhost mysql-5.5.11]# yum install ncurses-devel #IF 这一步出错 Warning: Bison executable not found in PATH -- Configuring done -- Generating done -- Build files have been written to: /software/mysql-5.5.11 [root@localhost mysql-5.5.11]# yum install bison [root@localhost mysql-5.5.11]# make && make install 编译完成。