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原始碼安裝MySql原始碼
- 原始碼安裝MySQL原始碼MySql
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- MySQL 5.7.28 原始碼安裝MySql原始碼
- mysql 5.1原始碼安裝MySql原始碼
- mysql-原始碼安裝MySql原始碼
- 安裝mysql原始碼出錯MySql原始碼
- MySQL 5.6.26原始碼安裝MySql原始碼
- MySQL 5.5 原始碼安裝流程MySql原始碼
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- mysql5.5.20原始碼安裝MySql原始碼
- 原始碼安裝mysql5.6.37原始碼MySql
- MySQL在CentOS 6.4 原始碼安裝MySqlCentOS原始碼
- 原始碼方式安裝mysql cluster 7.3.3原始碼MySql
- 原始碼方式安裝mysql 5.6.15原始碼MySql
- 原始碼編譯安裝MySQL 5.7.9原始碼編譯MySql
- 原始碼包安裝mysql5.1原始碼MySql
- Mysql5.6.22原始碼安裝MySql原始碼
- MySQL 5.7.9 原始碼安裝記錄MySql原始碼
- mysql5.5的原始碼安裝MySql原始碼
- 【轉】MySQL原始碼編譯安裝MySql原始碼編譯
- Mysql 學習篇之原始碼安裝mysqlMySql原始碼
- linux mysql 安裝步驟- 原始碼安裝5.7.17 版本LinuxMySql原始碼
- mysql之tar.gz原始碼安裝MySql原始碼
- MySQL 5.6原始碼編譯安裝流程MySql原始碼編譯
- 【整理】原始碼安裝mysql-5.6.10原始碼MySql
- MySQL 原始碼安裝及yum的使用MySql原始碼
- mysql-5.1.68-linux原始碼安裝MySqlLinux原始碼
- MySQL5.6 linux原始碼安裝MySqlLinux原始碼
- mysql8.0原始碼一鍵安裝指令碼MySql原始碼指令碼
- Linux 安裝 mysql 5.5.8(cmake原始碼安裝mysql5.5以上版本)[轉]LinuxMySql原始碼
- 阿里雲mysql原始碼編譯安裝阿里MySql原始碼編譯
- Linux使用原始碼來安裝MySQL 5.7Linux原始碼MySql
- mysql 原始碼安裝-5.7-17-19版本MySql原始碼
- MySQL5.7.16原始碼編譯安裝MySql原始碼編譯
- RedHat 6.4原始碼方式安裝mysql5.5Redhat原始碼MySql
- mysql原始碼安裝時遇到的問題MySql原始碼
- CentOS 7 原始碼編譯安裝 Mysql 5.7CentOS原始碼編譯MySql