CentOS 7 源碼編譯安裝MySQL 5.7.14

來源:互聯網
上載者:User

標籤:

一、添加使用者和組

1. 進入root:

su

2. 添加組:

groupadd mysql

3. 添加使用者:

useradd -r -g mysql -s /bin/false mysql

二、安裝

1. 首先到MySQL官網下載最新版的MySQL 5.7.14,進入http://dev.mysql.com/downloads/mysql/,選擇Source Code下的Generic Linux。

2. 解壓

tar zxvf mysql-5.7.14.tar.gz

3. 安裝MySQL所需要的工具:

(1) CMake,一個跨平台的安裝(編譯)工具;

(2) gcc-c++, C++編譯器;

(3) Boost庫,C++語言標準庫的擴充庫(這裡很可能會出現坑);

(4) perl,一種編程式言;

(5) bison, 一個文法分析器產生器;

(6) git,版本控制工具;

(7) curses,圖形函數庫。

yum install cmake gcc-c++ perl-Data-Dumper bison git ncurses-devel

4. 進入解壓完的mysql-5.7.14目錄,編譯源碼並產生makefile。

(1) 如果你的系統安裝了Boost-1.59庫,並且設定了環境變數,那麼執行:

cmake .

(2) 如果你的系統安裝了boost-1.59庫,那麼執行:

cmake . -DWITH_BOOST=path of boost

(3) 如果你的系統沒有安裝boost-1.59,那麼執行:

cmake . DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost

這條語句將會自動下載boost-1.59版本並安裝。

(4) 如果系統提示Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH),說明cmake的這兩個參數的值不對,那麼你在上面的基礎上加上兩個參數:

-DCURSES_LIBRARY=/usr/lib/libncurses.so -DCURSES_INCLUDE_PATH=/usr/include

5. 編譯:

make

6. 安裝:

make install

MySQL將會安裝到/usr/local/mysql目錄。

7. 進入安裝目錄:

cd /usr/local/mysql

8. 使用權限設定:

chown -R mysql .chgrp -R mysql .

9. 初始化資料庫:

bin/mysqld --initialize --user=mysqlbin/mysql_ssl_rsa_setupchown -R root .chown -R mysql databin/mysqld_safe --user=mysql &

 

CentOS 7 源碼編譯安裝MySQL 5.7.14

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.