centos 7.0 編譯 安裝mysql 5.6.22 過程 未完成~~持續

來源:互聯網
上載者:User

標籤:

 

mysql 下載目錄/usr/local/src
mysql 解壓目錄 /usr/local/bin/mysql

GitHub https://github.com/mysql/mysql-server

 

mysql官網的安裝說明
http://dev.mysql.com/doc/refman/5.6/en/source-installation.html

安裝mysql必須的要求
CMake make3.75以上 GCC 4.2.1以上 Perl
Curses ncurses-devel

 

最新3.1.1 cmake
http://www.cmake.org/

下載頁面
http://www.cmake.org/download/

下載目錄/usr/local/src
wget http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz

[[email protected] src]# wget http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz--2015-01-28 10:40:27-- http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz正在解析主機 www.cmake.org (www.cmake.org)... 66.194.253.19正在串連 www.cmake.org (www.cmake.org)|66.194.253.19|:80... 已串連。已發出 HTTP 要求,正在等待回應... 200 OK長度:5959421 (5.7M) [application/x-gzip]正在儲存至: “cmake-3.1.1.tar.gz”100%[======================================>] 5,959,421 494KB/s 用時 11s2015-01-28 10:40:39 (524 KB/s) - 已儲存 “cmake-3.1.1.tar.gz” [5959421/5959421])

 


解壓目錄 /usr/local/bin/cmake-3.1.1

[[email protected] src]tar zxvf cmake-3.1.1.tar.gz -C /usr/local/bin

 

進入解壓目錄
[[email protected] src]# cd /usr/local/bin/cmake-3.1.1
[[email protected] cmake-3.1.1]# ls
Auxiliary CompileFlags.cmake Help
bootstrap configure Licenses
CMakeCPack.cmake CONTRIBUTING.rst Modules
CMakeCPackOptions.cmake.in Copyright.txt README.rst
CMakeGraphVizOptions.cmake CTestConfig.cmake Source
CMakeLists.txt CTestCustom.cmake.in Templates
CMakeLogo.gif DartConfig.cmake Tests
cmake_uninstall.cmake.in doxygen.config Utilities

[[email protected] cmake-3.1.1]./bootstrap
[[email protected] cmake-3.1.1]make
[[email protected] cmake-3.1.1]make install

Make
http://www.gnu.org/software/make/
下載
wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz

[[email protected] src]# wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz--2015-01-28 11:22:09-- http://ftp.gnu.org/gnu/make/make-4.1.tar.gz正在解析主機 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b正在串連 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已串連。已發出 HTTP 要求,正在等待回應... 200 OK長度:1878787 (1.8M) [application/x-gzip]正在儲存至: “make-4.1.tar.gz”100%[======================================>] 1,878,787 33.1KB/s 用時 65s2015-01-28 11:23:16 (28.0 KB/s) - 已儲存 “make-4.1.tar.gz” [1878787/1878787])

 

解壓

[[email protected] src]tar zxvf make-4.1.tar.gz -C /usr/local/bin[[email protected] src]# cd /usr/local/bin/make-4.1[[email protected] make-4.1]# lsABOUT-NLS dep.h load.c README.VMSacinclude.m4 dir.c main.c README.W32aclocal.m4 doc make.1 remake.calloca.c dosbuild.bat Makefile.am remote-cstms.camiga.c expand.c Makefile.ami remote-stub.camiga.h file.c makefile.com rule.car.c filedef.h Makefile.DOS rule.harscan.c function.c Makefile.in SCOPTIONSAUTHORS getloadavg.c makefile.vms signame.cbuild.sh.in getopt1.c makeint.h SMakefilebuild_w32.bat getopt.c make.lnk strcache.ccommands.c getopt.h make_msvc_net2003.sln subproc.batcommands.h gettext.h make_msvc_net2003.vcproj testsconfig glob misc.c variable.cconfig.ami gmk-default.h NEWS variable.hconfigh.dos gmk-default.scm NMakefile version.cconfig.h.in gnumake.h output.c vmsdir.hconfig.h-vms guile.c output.h vmsfunctions.cconfig.h.W32 hash.c po vmsify.cconfigure hash.h read.c vmsjobs.cconfigure.ac implicit.c README vpath.cconfigure.bat INSTALL README.Amiga w32COPYING job.c README.customsdebug.h job.h README.DOSdefault.c loadapi.c README.OS2

 

[[email protected] make-4.1]./configure
[[email protected] make-4.1]make
[[email protected] make-4.1]make install

M4
http://www.gnu.org/software/m4/

下載
wget http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz

[[email protected] src]# wget http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz
--2015-01-28 11:37:14-- http://ftp.gnu.org/gnu/m4/m4-latest.tar.gz
正在解析主機 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b
正在串連 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已串連。
已發出 HTTP 要求,正在等待回應... 200 OK
長度:1820658 (1.7M) [application/x-gzip]
正在儲存至: “m4-latest.tar.gz”

100%[======================================>] 1,820,658 40.8KB/s 用時 42s

2015-01-28 11:37:57 (42.6 KB/s) - 已儲存 “m4-latest.tar.gz” [1820658/1820658])

解壓
[[email protected] src]# tar zxvf m4-latest.tar.gz -C /usr/local/bin

cd /usr/local/bin/m4-1.4.17

[[email protected] ~]# cd /usr/local/bin/m4-1.4.17
[[email protected] m4-1.4.17]# ls
acinclude.m4 build-aux configure GNUmakefile Makefile.am tests
aclocal.m4 c-boxes.el configure.ac INSTALL Makefile.in THANKS
AUTHORS cfg.mk COPYING lib NEWS TODO
BACKLOG ChangeLog doc m4 README
bootstrap checks examples maint.mk src

[[email protected] ~]./configure
[[email protected] ~]make
[[email protected] ~]make install

 

 

 

Bison 3.0.4
http://www.gnu.org/software/bison/

http://ftp.gnu.org/gnu/bison/

下載
wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz

[[email protected] src]# wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz--2015-01-28 11:03:56-- http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz正在解析主機 ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b正在串連 ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... 已串連。已發出 HTTP 要求,正在等待回應... 200 OK長度:3354179 (3.2M) [application/x-gzip]正在儲存至: “bison-3.0.4.tar.gz”100%[======================================>] 3,354,179 41.0KB/s 用時 71s2015-01-28 11:05:08 (45.8 KB/s) - 已儲存 “bison-3.0.4.tar.gz” [3354179/3354179])

 

解壓
tar zxvf bison-3.0.4.tar.gz -C /usr/local/bin

[[email protected] src]# tar zxvf bison-3.0.4.tar.gz -C /usr/local/bin


[[email protected] src]# cd /usr/local/bin/bison-3.0.4
[[email protected]ocalhost bison-3.0.4]# ls
ABOUT-NLS ChangeLog-1998 djgpp lib PACKAGING src
aclocal.m4 ChangeLog-2012 doc m4 po tests
AUTHORS configure etc maint.mk README THANKS
build-aux configure.ac examples Makefile.am README-alpha TODO
cfg.mk COPYING GNUmakefile Makefile.in README-release
ChangeLog data INSTALL NEWS runtime-po

這裡必須安裝M4 在運行
[[email protected] bison-3.0.4]./configure

[[email protected] bison-3.0.4]make
[[email protected] bison-3.0.4]make install

 

ncurses-devel (RPM安裝)
找到兩個網址下載 隨便來一個吧
http://pkgs.org/download/ncurses-devel
http://rpmfind.net/linux/rpm2html/search.php?query=ncurses-devel

下載
wget ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9-13.20130511.el7.x86_64.rpm

[[email protected] src]# wget ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9- 13.20130511.el7.x86_64.rpm--2015-01-28 14:28:29-- ftp://rpmfind.net/linux/centos/7.0.1406/os/x86_64/Packages/ncurses-devel-5.9- 13.20130511.el7.x86_64.rpm=> “ncurses-devel-5.9-13.20130511.el7.x86_64.rpm”正在解析主機 rpmfind.net (rpmfind.net)... 195.220.108.108正在串連 rpmfind.net (rpmfind.net)|195.220.108.108|:21... 已串連。正在以 anonymous 登入 ... 登入成功!==> SYST ... 完成。 ==> PWD ... 完成。==> TYPE I ... 完成。 ==> CWD (1) /linux/centos/7.0.1406/os/x86_64/Packages ... 完成。==> SIZE ncurses-devel-5.9-13.20130511.el7.x86_64.rpm ... 729820==> PASV ... 完成。 ==> RETR ncurses-devel-5.9-13.20130511.el7.x86_64.rpm ... 完成。長度:729820 (713K) (非正式資料)100%[======================================>] 729,820 275KB/s 用時 2.6s2015-01-28 14:28:36 (275 KB/s) - “ncurses-devel-5.9-13.20130511.el7.x86_64.rpm” 已儲存 [729820]

 


安裝或者升級一個rpm包
rpm -ivh rpm檔案【安裝】
rpm -Uvh rpm檔案【更新】

[[email protected] src]# rpm -ivh ncurses-devel-5.9-13.20130511.el7.x86_64.rpm準備中... ################################# [100%]正在升級/安裝...1:ncurses-devel-5.9-13.20130511.el7################################# [100%]

 


下載mysql 5.66.22
[[email protected] src]wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz
解壓
[[email protected] src]tar zxvf mysql-5.6.22.tar.gz -C /usr/local/bin
進入目錄
[[email protected] src]# cd /usr/local/bin/mysql-5.6.22
[[email protected] mysql-5.6.22]# ls
BUILD dbug libmysqld regex unittest
BUILD-CMAKE Docs libservices scripts VERSION
client Doxyfile-perfschema man sql vio
cmake extra mysql-test sql-bench win
CMakeLists.txt include mysys sql-common zlib
cmd-line-utils INSTALL-SOURCE mysys_ssl storage
config.h.cmake INSTALL-WIN-SOURCE packaging strings
configure.cmake libevent plugin support-files
COPYING libmysql README tests

 

 

[[email protected] mysql-5.6.22]# cmake .
-- Running cmake version 3.1.1
-- MySQL 5.6.22
-- Packaging as: mysql-5.6.22-Linux-x86_64
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- Using cmake version 3.1.1
-- Not building NDB
-- Library mysqlclient depends on OSLIBS -lpthread;m;dl
-- Library mysqlserver depends on OSLIBS -lpthread;m;crypt;dl
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/bin/mysql-5.6.22

[[email protected] mysql-5.6.22]make
[[email protected] mysql-5.6.22]make install

預設安裝路徑 /usr/local/mysql/


[[email protected] mysql-5.6.22]# cd /usr/local/mysql
[[email protected] mysql]# ls
bin data include lib mysql-test scripts sql-bench
COPYING docs INSTALL-BINARY man README share support-files

複製mysql.server到啟動目錄init.d
[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysql
[[email protected] mysql]# chkconfig mysql on
啟動mysql
[[email protected] mysql]# service mysql start
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).

參考
http://blog.rekfan.com/articles/186.html

 

以下是參考記錄而已~

錯誤資訊:安裝目錄下/usr/local/mysql
[[email protected] mysql]# ls
bin data include lib mysql-test scripts sql-bench
COPYING docs INSTALL-BINARY man README share support-files
[[email protected] mysql]# cd data
[[email protected] data]# ls
localhost.localdomain.err test
[[email protected] data]# vi localhost.localdomain.err
150128 17:11:06 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2015-01-28 17:11:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
explicit_defaults_for_timestamp server option (see documentation for more details).
2015-01-28 17:11:06 6958 [ERROR] Fatal error: Can‘t change to run as user ‘mysql‘ ; Please check that the user exists!

2015-01-28 17:11:06 6958 [ERROR] Aborting

2015-01-28 17:11:06 6958 [Note] Binlog end
2015-01-28 17:11:06 6958 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

150128 17:11:06 mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended

安裝MySQL

groupadd mysql #添加mysql組

useradd -g mysql mysql -s /bin/false #建立使用者mysql並加入到mysql組,不允許mysql使用者直接登入系統

mkdir -p /data/mysql #建立MySQL資料庫存放目錄

chown -R mysql:mysql /data/mysql #設定MySQL資料庫存放目錄許可權

mkdir -p /usr/local/mysql #建立MySQL安裝目錄

cd /usr/local/src #進入軟體包存放目錄

tar zxvf mysql-5.6.19.tar.gz #解壓

cd mysql-5.6.19 #進入目錄

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc #配置

make #編譯

make install #安裝

rm -rf /etc/my.cnf #刪除系統預設的設定檔(如果預設沒有就不用刪除)

cd /usr/local/mysql #進入MySQL安裝目錄

./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql #產生mysql系統資料庫

ln -s /usr/local/mysql/my.cnf /etc/my.cnf #添加到/etc目錄的軟串連

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #把Mysql加入系統啟動

chmod 755 /etc/init.d/mysqld #增加執行許可權

chkconfig mysqld on #加入開機啟動

vi /etc/rc.d/init.d/mysqld #編輯

basedir=/usr/local/mysql #MySQL程式安裝路徑

datadir=/data/mysql #MySQl資料庫存放目錄

service mysqld start #啟動

vi /etc/profile #把mysql服務加入系統內容變數:在最後添加下面這一行

export PATH=$PATH:/usr/local/mysql/bin

source /etc/profile

下面這兩行把myslq的庫檔案連結到系統預設的位置,這樣你在編譯類似PHP等軟體時可以不用指定mysql的庫檔案地址。

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

ln -s /usr/local/mysql/include/mysql /usr/include/mysql

mkdir /var/lib/mysql #建立目錄

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock #添加軟連結

mysql_secure_installation #設定Mysql密碼,根據提示按Y 斷行符號輸入2次密碼

 

/etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

 

cmake .\
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_NUIX_ADDR=/var/lib/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

 

CMake Error: The source directory "/usr/local/bin/mysql-5.6.22/=/usr/etc" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

 

寫的比較混亂還沒有完成整理好 主要是出錯了 新手玩這個好有壓力~

centos 7.0 編譯 安裝mysql 5.6.22 過程 未完成~~持續

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.