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 編譯完成。