MYSQL 5.6.27原始碼安裝
1、需要安裝的工具
# gcc、make、cmake
# 5.6 gcc 41, cmake 2.6.3
yum install -y gcc make cmake
2)mysql依賴包支援語法分析的bison庫和終端類GUI支援ncurses
yum install -y bison*
yum install -y ncurses*
yum install -y libaio
2、tcmalloc
### depend
# libunwind-1.1.tar.gz
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
### tcmalloc
./configure --enable-minimal --disable-cpu-profiler --disable-heap-profiler --disable-heap-checker --disable-debugalloc
make && make install
echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
ldconfig
### ERROR
# /usr/bin/ld: cannot find -ltcmalloc
ln -s /usr/local/lib/libtcmalloc_minimal.so /usr/lib/libtcmalloc.so
3、install
# 建立安裝目錄
mkdir /usr/local/mysql
# 清除
make clean
# 檢視支援的配置項 http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
# 預設包含的引擎:MyISAM, MERGE, MEMORY, and CSV
cmake . -LH | more
# normal
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/my5627 \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
# LOAD DATA INFILE, 0 disable DEFAULT, 1 enable
-DENABLED_LOCAL_INFILE=1
# with tcmalloc
-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF
# make
#加快編譯速度,使用多核並行編譯,即8為計算的核的個數
make -j 8
make install
4、 Create a mysql User and Group
groupadd mysql
# the -r option to create a user that does not have login permissions to your server host
useradd -r -g mysql mysql
5、初始化
/usr/local/mysql/my5627/scripts/mysql_install_db --no-defaults --user=mysql --basedir=/usr/local/mysql/my5627 --datadir=/usr/local/mysql/my5627/data
6、建立 /usr/local/mysql/my5627/cnf/my.cnf
[mysqld]
datadir=/usr/local/mysql/my5627/data
socket=/tmp/mysql5627.sock3306
port=3306
user=mysql
7、啟動
# mysqld_safe
/usr/local/mysql/my5627/bin/mysqld_safe --defaults-file=/usr/local/mysql/my5627/cnf/my.cnf &
8、配置mysql服務
# 單例項
cp /usr/local/mysql/my5627/support-files/mysql.server /etc/init.d/mysqld5627
chkconfig --add mysqld5627
chkconfig mysqld5627 on
9、設定root密碼
# 由於 mysql_secure_installation 不能設定socket,只能做個軟連結
ln -s /tmp/mysql5627.sock3306 /tmp/mysql.sock
/usr/local/mysql/my5627/bin/mysql_secure_installation
### 編譯到 /usr/local/mysql_5629路徑
# mysqld_multi.server 修改
--
basedir=/usr/local/mysql
bindir=/usr/local/mysql/bin
++
basedir=/usr/local/mysql_5629
bindir=$basedir/bin
#
--
$opt_mysqladmin = "/usr/local/mysql_5629/bin/mysqladmin";
$opt_mysqld = "/usr/local/mysql_5629/bin/mysqld";
++
push @defaults_options, "-s";
$opt_path = "/usr/local/mysql_5629";
$default_file = "$opt_path/my.cnf";
$opt_mysqladmin = "$opt_path/bin/mysqladmin";
$opt_mysqld = "$opt_path/bin/mysqld";
sub defaults_for_group{
--
my $com= join ' ', 'my_print_defaults', @defaults_options, $group;
++
my $com= join ' ', 'my_print_defaults', " --defaults-file=$default_file ", @defaults_options, $group;
}
# gcc、make、cmake
# 5.6 gcc 41, cmake 2.6.3
yum install -y gcc make cmake
2)mysql依賴包支援語法分析的bison庫和終端類GUI支援ncurses
yum install -y bison*
yum install -y ncurses*
yum install -y libaio
2、tcmalloc
### depend
# libunwind-1.1.tar.gz
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
### tcmalloc
./configure --enable-minimal --disable-cpu-profiler --disable-heap-profiler --disable-heap-checker --disable-debugalloc
make && make install
echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
ldconfig
### ERROR
# /usr/bin/ld: cannot find -ltcmalloc
ln -s /usr/local/lib/libtcmalloc_minimal.so /usr/lib/libtcmalloc.so
3、install
# 建立安裝目錄
mkdir /usr/local/mysql
# 清除
make clean
# 檢視支援的配置項 http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
# 預設包含的引擎:MyISAM, MERGE, MEMORY, and CSV
cmake . -LH | more
# normal
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/my5627 \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
# LOAD DATA INFILE, 0 disable DEFAULT, 1 enable
-DENABLED_LOCAL_INFILE=1
# with tcmalloc
-DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc" -DWITH_SAFEMALLOC=OFF
# make
#加快編譯速度,使用多核並行編譯,即8為計算的核的個數
make -j 8
make install
4、 Create a mysql User and Group
groupadd mysql
# the -r option to create a user that does not have login permissions to your server host
useradd -r -g mysql mysql
5、初始化
/usr/local/mysql/my5627/scripts/mysql_install_db --no-defaults --user=mysql --basedir=/usr/local/mysql/my5627 --datadir=/usr/local/mysql/my5627/data
6、建立 /usr/local/mysql/my5627/cnf/my.cnf
[mysqld]
datadir=/usr/local/mysql/my5627/data
socket=/tmp/mysql5627.sock3306
port=3306
user=mysql
7、啟動
# mysqld_safe
/usr/local/mysql/my5627/bin/mysqld_safe --defaults-file=/usr/local/mysql/my5627/cnf/my.cnf &
8、配置mysql服務
# 單例項
cp /usr/local/mysql/my5627/support-files/mysql.server /etc/init.d/mysqld5627
chkconfig --add mysqld5627
chkconfig mysqld5627 on
9、設定root密碼
# 由於 mysql_secure_installation 不能設定socket,只能做個軟連結
ln -s /tmp/mysql5627.sock3306 /tmp/mysql.sock
/usr/local/mysql/my5627/bin/mysql_secure_installation
### 編譯到 /usr/local/mysql_5629路徑
# mysqld_multi.server 修改
--
basedir=/usr/local/mysql
bindir=/usr/local/mysql/bin
++
basedir=/usr/local/mysql_5629
bindir=$basedir/bin
#
--
$opt_mysqladmin = "/usr/local/mysql_5629/bin/mysqladmin";
$opt_mysqld = "/usr/local/mysql_5629/bin/mysqld";
++
push @defaults_options, "-s";
$opt_path = "/usr/local/mysql_5629";
$default_file = "$opt_path/my.cnf";
$opt_mysqladmin = "$opt_path/bin/mysqladmin";
$opt_mysqld = "$opt_path/bin/mysqld";
sub defaults_for_group{
--
my $com= join ' ', 'my_print_defaults', @defaults_options, $group;
my $com= join ' ', 'my_print_defaults', " --defaults-file=$default_file ", @defaults_options, $group;
}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26250550/viewspace-1824836/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- MySQL 5.7.28 原始碼安裝MySql原始碼
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- mysql5.5.20原始碼安裝MySql原始碼
- 【轉】MySQL原始碼編譯安裝MySql原始碼編譯
- MySQL5.7.16原始碼編譯安裝MySql原始碼編譯
- 阿里雲mysql原始碼編譯安裝阿里MySql原始碼編譯
- Linux使用原始碼來安裝MySQL 5.7Linux原始碼MySql
- mysql之tar.gz原始碼安裝MySql原始碼
- mysql8.0原始碼一鍵安裝指令碼MySql原始碼指令碼
- MYSQL5.7.22 原始碼安裝 主從搭建MySql原始碼
- CentOS7.X原始碼安裝MySQL-5.7.18CentOS原始碼MySql
- Mysql5.6 for Centos6.5原始碼編譯安裝MySqlCentOS原始碼編譯
- mysql 原始碼安裝-5.7-17-19版本MySql原始碼
- 原始碼安裝openresty原始碼REST
- nginx原始碼安裝Nginx原始碼
- 原始碼安裝postgresql原始碼SQL
- Nginx 原始碼安裝Nginx原始碼
- 原始碼安裝GO原始碼Go
- PostgreSQL 10.12 安裝系列 - 原始碼安裝SQL原始碼
- 【推薦 - 原始碼安裝】nginx - 安裝原始碼Nginx
- Ubuntu 16.04下 Mysql5.7.17原始碼編譯與安裝UbuntuMySql原始碼編譯
- MYSQL5.6.40原始碼安裝 主從搭建 主主搭建MySql原始碼
- GDB 除錯 Mysql 實戰(一)原始碼編譯安裝除錯MySql原始碼編譯
- 基於Linux的MySQL5.7原始碼編譯安裝LinuxMySql原始碼編譯
- MYSQL5.7.22 原始碼安裝 主從搭建 + KEEPALIVED高可用MySql原始碼
- yum安裝與原始碼安裝比較原始碼
- linux安裝python3(原始碼安裝)LinuxPython原始碼
- paramiko 2.4.1原始碼安裝原始碼
- macbook 原始碼安裝 redisMac原始碼Redis
- macbook 原始碼安裝 nginxMac原始碼Nginx
- docker原始碼安裝NginxDocker原始碼Nginx
- 【PG安裝】postgresql10 for linux 原始碼安裝SQLLinux原始碼
- EOS原始碼分析(1)安裝原始碼
- PostgreSQL-原始碼安裝(一)SQL原始碼
- 原始碼編譯安裝Redis原始碼編譯Redis
- openeuler原始碼安裝Postgresql 16原始碼SQL
- 原始碼安裝Nginx和PHP原始碼NginxPHP
- 原始碼包安裝過程原始碼