MySQL 5.7.10最新版本原始碼安裝詳細過程
1,下載地址:
可以wget下載,也可以在pc本地網頁上下載完再遠端傳到linux上面去。
文件乾貨在這裡:
# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -gmysql -s /bin/false mysql
# Beginning of source-build specificinstructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake .
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd/usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db--user=mysql # Before MySQL 5.7.6
shell> bin/mysqld--initialize --user=mysql # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup
shell> chown -R root .
shell> chown -R mysqldata
shell> bin/mysqld_safe--user=mysql &
# Next command is optional
shell> cpsupport-files/mysql.server /etc/init.d/mysql.server
PS:看到差別在於,bin/mysqld--initialize --user=mysql # MySQL 5.7.6 and up
2,新增mysql使用者
groupadd mysql
useradd -g mysql mysql
autoreconf --force --install
libtoolize --automake --force
automake --force --add-missing
3,安裝元件準備
yum install gcc gcc-c++ -y
yum install -y ncurses-devel.x86_64
yum install -y cmake.x86_64
yum install -y libaio.x86_64
yum install -y bison.x86_64
yum install -y gcc-c++.x86_64
4,資料庫規劃
mysql軟體目錄 : /usr/local/mysql5710
mysql資料目錄:/home/data/mysql5710/data/
mysql日誌目錄:/home/data/mysql5710/log/
mkdir -p /home/data/mysql5710/data
mkdir -p /usr/local/mysql5710
mkdir -p/home/data/mysql5710/log/
5,開始預編譯
time cmake .-DCMAKE_INSTALL_PREFIX=/usr/local/mysql5710 -DMYSQL_DATADIR=/home/data/mysql5710/data-DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/usr/local/mysql5710/mysql.sock-DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
有報錯資訊:
CMake Error at cmake/boost.cmake:76(MESSAGE):
Youcan download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
This CMake script will look for boost in <directory>. If it is not there,
itwill download and unpack it (in that directory) for you.
Ifyou are inside a firewall, you may need to use an http proxy:
新增引數-DDOWNLOAD_BOOST=1 -DWITH_BOOST=/home/mysql5710/,繼續編譯:
time cmake .-DCMAKE_INSTALL_PREFIX=/usr/local/mysql5710-DMYSQL_DATADIR=/home/data/mysql5710/data -DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR==/usr/local/mysql5710/mysql.sock -DMYSQL_USER=mysql-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1-DWITH_BOOST=/usr/local/boost/
看到報錯資訊:
-- [download 31% complete]
-- Download failed, error: 28;"Timeoutwas reached"
CMake Error at cmake/boost.cmake:177(MESSAGE):
Youcan try downloading
http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
manually using curl/wget or a similar tool, or increase the value of
DOWNLOAD_BOOST_TIMEOUT (which is now 600 seconds)
Call Stack (most recent call first):
CMakeLists.txt:435 (INCLUDE)
-- Configuring incomplete, errors occurred!
然後再繼續,設定一個DOWNLOAD_BOOST_TIMEOUT=28800來繼續下載:
[[email protected]_idc_mon_1_12 mysql-5.7.10]# timecmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5710-DMYSQL_DATADIR=/home/data/mysql5710/data -DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR==/usr/local/mysql5710/mysql.sock -DMYSQL_USER=mysql-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1-DWITH_BOOST=/usr/local/boost/ -DOWNLOAD_BOOST_TIMEOUT=28800
也不行,報一樣的錯誤,看來還是需要手動下載了
mkdir -p /usr/local/boost
然後繼續編譯:
time cmake .-DCMAKE_INSTALL_PREFIX=/usr/local/mysql5710-DMYSQL_DATADIR=/home/data/mysql5710/data -DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR==/usr/local/mysql5710/mysql.sock -DMYSQL_USER=mysql-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=/usr/local/boost/
最好出現如下資訊表示編譯通過:
……
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS:_GNU_SOURCE;_FILE_OFFSET_BITS=64;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: /root/mysql-5.7.10
6,time make
這個時間比較長,需要耐心等待中,如下所示:
[[email protected]_idc_mon_1_12 mysql-5.7.10]# timemake
……
Scanning dependencies of targetmysql_embedded
[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/completion_hash.cc.o
[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/mysql.cc.o
[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o
Linking CXX executable mysql_embedded
[100%] Built target mysql_embedded
Scanning dependencies of targetmysqltest_embedded
[100%] Building CXX objectlibmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o
Linking CXX executable mysqltest_embedded
[100%] Built target mysqltest_embedded
Scanning dependencies of targetmy_safe_process
[100%] Building CXX objectmysql-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
7, time make install
這個執行起來比較快一些,如下所示:
[[email protected]_idc_mon_1_12 mysql-5.7.10]# timemake install
……
-- Installing:/usr/local/mysql5710/mysql-test/lib/My/SafeProcess/my_safe_process
-- Up-to-date:/usr/local/mysql5710/mysql-test/lib/My/SafeProcess/my_safe_process
-- Installing: /usr/local/mysql5710/mysql-test/lib/My/SafeProcess/Base.pm
-- Installing:/usr/local/mysql5710/support-files/my-default.cnf
-- Installing:/usr/local/mysql5710/support-files/mysqld_multi.server
-- Installing:/usr/local/mysql5710/support-files/mysql-log-rotate
-- Installing:/usr/local/mysql5710/support-files/magic
-- Installing:/usr/local/mysql5710/share/aclocal/mysql.m4
-- Installing:/usr/local/mysql5710/support-files/mysql.server
8,配置my.cnf啟動引數檔案
[client]
#password = [your_password]
port = 3308
socket = /usr/local/mysql5710/mysql.sock
loose-default-character-set=gbk
[mysqld]
default-storage-engine=INNODB
group_concat_max_len =99999
# generic configuration options
port = 3307
socket = /usr/local/mysql5710/mysql.sock
pid-file = /usr/local/mysql5710/mysqld.pid
datadir = /home/data/mysql5710/data
user = mysql
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-external-locking
skip-name-resolve
explicit_defaults_for_timestamp
……
9,初始化資料庫
shell> bin/mysql_install_db--user=mysql # Before MySQL 5.7.6
shell> bin/mysqld--initialize --user=mysql # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
9.1 利用my.cnf初始化
[[email protected]_idc_mon_1_12 root]# cd /usr/local/mysql5710/bin/
[[email protected]_idc_mon_1_12 bin]# ./mysqld--initialize --user=mysql --basedir=/usr/local/mysql5710--datadir=/home/data/mysql5710/data --defaults-file=/usr/local/mysql5710/my.cnf
2015-12-17T09:44:00.021750Z 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2015-12-17T09:44:00.462018Z 0 [Warning] InnoDB:New log files created, LSN=45790
2015-12-17T09:44:00.652738Z 0 [Warning] InnoDB:Creating foreign key constraint system tables.
2015-12-17T09:44:00.712997Z 0 [ERROR] unknownvariable 'defaults-file=/usr/local/mysql5710/my.cnf'
2015-12-17T09:44:00.713034Z 0 [ERROR] Aborting
[[email protected]_idc_mon_1_12 bin]#
貌似報錯了,不識別defaults-file的引數
9.2 預設啟動
會報錯如下:
[[email protected]_idc_mon_1_12 bin]# rm -rf/home/data/mysql5710/data/*
[[email protected]_idc_mon_1_12 bin]# ./mysqld--initialize --user=mysql --basedir=/usr/local/mysql5710--datadir=/home/data/mysql5710/data
2015-12-17T09:48:07.344700Z 0 [Warning]TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).
2015-12-17T09:48:07.705225Z 0 [Warning]InnoDB: New log files created, LSN=45790
2015-12-17T09:48:07.795939Z 0 [Warning]InnoDB: Creating foreign key constraint system tables.
2015-12-17T09:48:07.807878Z 0 [Warning] Noexisting UUID has been found, so we assume that this is the first time thatthis server has been started. Generating a new UUID: 46bcea55-a4a3-11e5-b7ee-000c29ff8c77.
2015-12-17T09:48:07.809546Z 0 [Warning]Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot beopened.
2015-12-17T09:48:07.811257Z 1 [Note] Atemporary password is generated for [email protected]: 4e3taITlXU%/
[[email protected]_idc_mon_1_12 bin]#
PS:看到這裡有一個初始化root密碼,記下來,不然啟動完後,mysql登入就報密碼錯誤登入不了。
10,安裝ssl
[[email protected]_idc_mon_1_12 bin]#./mysql_ssl_rsa_setup
Generating a 2048 bit RSA private key
..........+++
.................................................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
..+++
..................................................................................................................................................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.......................................................................+++
..+++
writing new private key to 'client-key.pem'
-----
[[email protected]_idc_mon_1_12 bin]#
11,部署啟動服務
準備服務:
[[email protected]_idc_mon_1_12 bin]# cp../support-files/mysql.server /etc/init.d/mysqld5710
[[email protected]_idc_mon_1_12 bin]# chmod 700/etc/init.d/mysqld5710
[[email protected]_idc_mon_1_12 bin]# echo"export PATH=$PATH:/usr/local/mysql5710/bin">>/etc/profile
[[email protected]_idc_mon_1_12 bin]# source/etc/profile
[[email protected]_idc_mon_1_12 bin]#
設定開機啟動
[[email protected]_idc_mon_1_12 bin]# chkconfigmysqld5710 on
[[email protected]_idc_mon_1_12 bin]#
啟動報錯:
[[email protected]_idc_mon_1_12 bin]# servicemysqld5710 start
Starting MySQL....The server quit withoutupdating PID file[失敗]/local/mysql5710/mysqld.pid).
[[email protected]_idc_mon_1_12 bin]#
檢視後臺報錯日誌mysqld.log:
2015-12-17T09:54:40.004720Z 0 [ERROR]InnoDB: redo log file './ib_logfile0' exists. Creating system tablespace withexisting redo log files is not recommended. Please delete all redo log file
s before creating new system tablespace.
2015-12-17T09:54:40.004744Z 0 [ERROR]InnoDB: InnoDB Database creation was aborted with error Generic error. You mayneed to delete the ibdata1 file before trying to start up again.
2015-12-17T09:54:40.305233Z 0 [ERROR]Plugin 'InnoDB' init function returned error.
2015-12-17T09:54:40.305292Z 0 [ERROR]Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-12-17T09:54:40.305305Z 0 [ERROR]Failed to initialize plugins.
2015-12-17T09:54:40.305315Z 0 [ERROR]Aborting
2015-12-17T09:54:40.305333Z 0 [Note] Binlogend
2015-12-17T09:54:40.306240Z 0 [Note]/usr/local/mysql5710/bin/mysqld: Shutdown complete
解決辦法:
[[email protected]_idc_mon_1_12 data]# rm -rfib_logfile0 ib_logfile1
[[email protected]_idc_mon_1_12 data]#
然後再啟動mysql,有報錯資訊如下:
2015-12-17T10:02:46.169594Z 0 [Warning] InnoDB: Cannot open tablemysql/plugin from the internal data dictionary of InnoDB though the .frm filefor the table exists. Please refer to http://de
v.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how toresolve the issue.
mysqld: Table 'mysql.plugin' doesn't exist
2015-12-17T10:02:46.169680Z 0 [ERROR] Can't open the mysql.plugintable. Please run mysql_upgrade to create it.
2015-12-17T10:02:46.169907Z 0 [ERROR] unknown variable'max_connection=10000'
2015-12-17T10:02:46.169928Z 0 [ERROR] Aborting
修改my.cnf裡面,註釋掉max_connection=10000即可。後面陸陸續續報如下錯誤
2015-12-17T10:07:22.243181Z 0 [ERROR]unknown variable 'max_user_connection=3009'
2015-12-17T10:16:15.870396Z 0 [ERROR]unknown variable 'thread_concurrency=8'
2015-12-17T10:16:51.251271Z 0 [ERROR]unknown option '--myisam_recover'
然後全部在my.cnf裡面註釋掉,再啟動mysqld服務,正常啟動了,如下所示:
[[email protected]_idc_mon_1_12 mysql5710]# servicemysqld5710 start
Starting MySQL.. [確定]
[[email protected]_idc_mon_1_12 mysql5710]#
至此,mysql5.7.10安裝部署成功了。
12,重置密碼
利用mysqladmin重置密碼
[[email protected]_idc_mon_1_12 mysql5710]#./bin/mysqladmin -h localhost -uroot password "root" -p'4e3taITlXU%/'--socket=/usr/local/mysql5710/mysql.sock
mysqladmin: [Warning] Using a password onthe command line interface can be insecure.
Warning: Since password will be sent toserver in plain text, use ssl connection to ensure password safety.
[[email protected]_idc_mon_1_12 mysql5710]#
使用新密碼登入:
[[email protected]_idc_mon_1_12 mysql5710]# mysql--socket=/usr/local/mysql5710/mysql.sock -uroot -proot
Warning: Using a password on the commandline interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.10-log Sourcedistribution
Copyright (c) 2000, 2013, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql>
OK,mysql5.7.10安裝徹底結束了,下面就可以開始驗證5.7的新特性了。
13,番外篇
http://www.lengdo.com/blog/view/id/52.html,這裡的blog主,說:MySQL啟動後一切正常,但是大概在五六分鐘後MySQL記憶體開始莫名飆升到500M,然後就穩定在500M左右,所有的 buffer, size, cache 等都是按最小配置,無 SQL 請求,甚至關閉 innodb 都無效。
所以準備探討一番他的症狀所在。
啟動mysql5.7後,剩餘1927M記憶體,如下所示:
[[email protected]_idc_mon_1_12 mysql-5.7.10]#
[[email protected]_idc_mon_1_12 mysql-5.7.10]# free-m
total used free shared buffers cached
Mem: 32110 30182 1927 0 349 24095
-/+ buffers/cache: 5737 26372
Swap: 3967 12 3955
[[email protected]_idc_mon_1_12 mysql-5.7.10]#
[[email protected]_idc_mon_1_12 mysql-5.7.10]#
停止mysql5.7後,剩餘2841m記憶體,如下所示:
[[email protected]_idc_mon_1_12 mysql-5.7.10]#service mysqld5710 stop
Shutting down MySQL.. [確定]
[[email protected]_idc_mon_1_12 mysql-5.7.10]# free-m
total used free shared buffers cached
Mem: 32110 29268 2841 0 349 24083
-/+ buffers/cache: 4835 27274
Swap: 3967 12 3955
[[email protected]_idc_mon_1_12 mysql-5.7.10]#
大概用了一個G左右,而我的buffer_pool設定就是4G,可能是啟動mysql載入buffer pool的記憶體消耗,有待後續驗證。
相關推薦
MySQL 5.7.10最新版本原始碼安裝詳細過程
1,下載地址:可以wget下載,也可以在pc本地網頁上下載完再遠端傳到linux上面去。 文件乾貨在這裡:# Preconfiguration setupshell> groupadd mysqlshell> useradd -r -gmysql -s /bin/
MySQL 5.7.10最新版本號源碼安裝具體過程
ngs htm org ear xpl can 數據文件 private which 1,下載地址:安裝包下載地址:http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz能夠wget下載,也能夠在p
MySQL 5.7.18 zip版本的安裝使用方法
系統服務 系統 javascrip sta idt sse assets ini文件 mark MySQL 5.7.18 zip版本的安裝使用方法 這個版本的MySQL不像那種點擊就可以立即安裝,一直下一步就OK的,這個需要自己進行配置,雖然有點小麻煩,我還是比較喜歡使用
CentOS7.2安裝MySQL 5.7.10
1.下載MySQL源 wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm 2.安裝MySQL源 sudo rpm -ivh mysql57-community-release-el7-7.
mysql 5.7.14 二進位制版本詳細安裝過程
安裝環境: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise 安裝版本 mysql5.7.7及以上做了很多改變,5.7.7以前安裝方法和以前差不多,初始化也保留了mysql_in
MySQL 5.7.18 在centos下安裝記錄
iba entos tool 鏈接 ready res data vim mysq 一個朋友找我如何在Linux下安裝mysql5.7.18,我稍微整理下了下記錄,如下: 下載地址: MySQL5.7.18參數官方網址:https://dev.mysql.com/doc/r
mysql 5.7.10 啟動多實例筆記
tin strong oca error datadir mysqld default init ini 1. 復制配置文件 cp /etc/my.cnf /etc/my3308.cnf 2. 修改配置文件 3. 創建目錄, 並賦予權限 4.
mysql 5.7.20解壓版安裝配置
conn 搜索 解壓縮 win 登陸用戶 toolbar 搜索欄 顯示 title 下載地址為: https://dev.mysql.com/downloads/mysql/ 最下面根據自己的操作系統選擇合適的型號 下載完以後解壓縮到自定義的路徑。這裏註意的是
mysql 5.7.12二進制安裝
chan linux net red open soft xtend hdp chown 1.my.cnf配置文件參數:vim /etc/my.cnf [client] port = 3306 socket = /tmp/mysq
mysql-5.7.21 二進制安裝 | Jemalloc內存優化 | 備份恢復|修改密碼
isolation max ali break edi limit ola lower mysql- 簡介 ######數據庫目錄/usr/local/mysql############ ######數據目錄/data/mysql############ ######慢日誌
mysql-5.6.x和mysql-5.7.x二進制安裝
mysql#!/bin/bash#__Author__:Allen_Jol at 2018-03-21 13:52:13#Description: install mysql-5.6.39 or mysql-5.7.21 binary for centos 6.xCPUINFO=`cat /proc/cpui
mysql 5.7.21 二進制安裝
MySQL1. 說明適用於CentOS 6.*和CentOS 7.* 系統版本:CentOS 6.8_x86-64 mysql版本:mysql-5.7.21-linux-glibc2.5-x86_64.tar.gz mysql程序安裝路徑:/data/mysql mysql數據存放路徑:/data/m
MySQL 5.7.22 二進制安裝
錯誤 case ble 最大 thread ice ive 打開 hash MySQL 5.7.22 二進制安裝 一、到官網下載mysql-5.7.22二進制包 二、創建mysql用戶: useradd mysql -s /sbin/nologin -M 三
mysql-5.7.23-el7-x86_64.tar安裝配置
sha link dia x86 tar skip import tps iba 下載安裝包:https://dev.mysql.com/downloads/mysql/ 下載好後,解壓,我這裏把mysql-5.7.23-el7-x86_64.tar 改名成了mysql
mysql-5.7.23源碼編譯安裝
-c mpat ora else temporary 文件 cte name remove mysql-5.7.23源碼編譯安裝 1.下載源碼 # wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23.ta
mysql 5.7.23 解壓版安裝教程
skip init mod datadir cte 5.7 圖片 文件 ant 下載mysql安裝程序 官方下載地址:http://dev.mysql.com/downloads/mysql/ 解壓下載文件,如圖 其中data和my.ini文件需要自己創建 m
Linux MySQL 5.7二進位制 小版本升級
Linux MySQL 5.7二進位制 小版本升級 MySQL5.7二進位制安裝在Unix/Linux上升級時,分為就地和邏輯升級方法。 1 就地升級 就地升級包括關閉舊的MySQL伺服器,用新的MySQL伺服器替換舊的MySQL二進位制檔案或軟體包,在現有資料目錄上重新啟動MySQL,以及執行mysq
Windows下MySQL-5.7.23的配置與安裝
1. MySQL下載,解壓縮和環境設定 下載MySQL:https://dev.mysql.com/downloads/mysql/ 解壓到E盤:E:\MySQL-5.7.23 配置環境設定: 變數名:
MySQL 5.7.10 自動備份、自動清理舊備份集
MySQL版本是5.7.10-log社群版本,需要進行備份,但是備份時間長了後,磁碟不夠用,所以需要對指定舊的備份集合進行清理工作。1,mysqldump備份指令碼備份指令碼為,裡面有幾個需要注意的引數:(1)--master-data=2 :這個引數可以在搭建從庫的時候,記
mysql-5.7.12-win64綠色版安裝步驟
添加 https default png pass 搜索 mysql 電腦 直接 第一步:下載綠色版MySQL; 網盤地址: 鏈接:https://pan.baidu.com/s/1iiYpc6c1xzCprW2OjaQv0Q 提取碼:ql7f 第二步:1.配置環境變量