1、準備 cmake-3.6.0.tar.gz bison-3.0.4.tar.gz mysql-5.7.13.tar.gz (http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz) 2、安裝cmake 和 bison 首先 ...
1、準備
cmake-3.6.0.tar.gz
bison-3.0.4.tar.gz
mysql-5.7.13.tar.gz (http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz)
2、安裝cmake 和 bison
首先可以查看下是否安裝了 cmake
# rpm -qa |grep cmake
# tar zxvf cmake-3.6.0.tar.gz # cd cmake-3.6.0 # ./bootstrap # make && make install
# tar zxvf bison-3.0.4.tar.gz # cd bison-3.0.4 # ./configure # make && make install
3、安裝Mysql
[root@localhost src]# tar -zxvf mysql-5.7.13.tar.gz [root@localhost src]# cd mysql-5.7.13 [root@localhost mysql-5.7.13]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_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 ... CMake Error at cmake/boost.cmake:81 (MESSAGE): You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> This CMake script will look for boost in <directory>. If it is not there, it will download and unpack it (in that directory) for you. If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80 Call Stack (most recent call first): cmake/boost.cmake:238 (COULD_NOT_FIND_BOOST) CMakeLists.txt:451 (INCLUDE) -- Configuring incomplete, errors occurred!
-DCMAKE_INSTALL_PREFIX=dir_name | 設置mysql安裝目錄 |
-DMYSQL_UNIX_ADDR=file_name | 設置監聽套接字路徑,這必須是一個絕對路徑名。預設為/tmp/mysql.sock |
-DDEFAULT_CHARSET=charset_name | 設置伺服器的字元集。 預設情況下,MySQL使用latin1的(CP1252西歐)字元集。cmake/character_sets.cmake文件包含允許的字元集名稱列表。 |
-DDEFAULT_COLLATION=collation_name | 設置伺服器的排序規則。 |
-DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 |
存儲引擎選項: MyISAM,MERGE,MEMORY,和CSV引擎是預設編譯到伺服器中,並不需要明確地安裝。 靜態編譯一個存儲引擎到伺服器,使用-DWITH_engine_STORAGE_ENGINE= 1 可用的存儲引擎值有:ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE (InnoDB), PARTITION (partitioning support), 和PERFSCHEMA (Performance Schema) |
-DMYSQL_DATADIR=dir_name | 設置mysql資料庫文件目錄 |
-DMYSQL_TCP_PORT=port_num | 設置mysql伺服器監聽埠,預設為3306 |
-DENABLE_DOWNLOADS=bool | 是否要下載可選的文件。例如,啟用此選項(設置為1),cmake將下載谷歌所使用的測試套件運行單元測試。 |
<<==========================================================================
解決:
(1)在預編譯時添加相應的選項:cmake -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
(2)或者下載一個boost包,放到/usr/local/boost目錄下,然後在cmake後面加選項-DWITH_BOOST=/usr/local/boost
==========================================================================>>
[root@localhost mysql-5.7.13]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_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 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost.... CMake Error at cmake/readline.cmake:64 (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:107 (FIND_CURSES)
cmake/readline.cmake:181 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:479 (MYSQL_CHECK_EDITLINE)
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-5.7.13/CMakeFiles/CMakeOutput.log". See also "/usr/local/src/mysql-5.7.13/CMakeFiles/CMakeError.log".
<<=========================================================================
解決:
(1)安裝ncurses-devel
yum -y install ncurses-devel
(2)刪除CMakeCache.txt
rm CMakeCache.txt
(3)重新cmake
[root@localhost mysql-5.7.13]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=mysql.mysql -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_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 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
==========================================================================>>
[root@localhost mysql-5.7.13]# make
[root@localhost mysql-5.7.13]# make install