mysql5.5安裝
mysql5.5後相對以前的版本有個很大的改變,5.5後採用cmake編譯,並且innodb作為預設的儲存引擎,replication採用半同步
複製。和以前的非同步複製相比,在極端的情況下資料的一致性有了很大的保證。下面的指令碼只是對mysql5.5的安裝做了簡要的說明。
#!/bin/bash
#Author: Andy
#Time: 20130905
#./my5install.sh
GROUP=mysql
USER=mysql
PORT=3306
VERSION=5.5.22
CVERSION=2.8.7
FILE_PATH=/root/mysql
MYSQL_BASE=/usr/local/mysql
DATA_HOME=/var/lib/mysql
cat /etc/group|grep "${GROUP}">/dev/null
if [ $? -ne 0 ];then
#!/bin/bash
#Author: Andy
#Time: 20130905
#./my5install.sh
GROUP=mysql
USER=mysql
PORT=3306
VERSION=5.5.22
CVERSION=2.8.7
FILE_PATH=/root/mysql
MYSQL_BASE=/usr/local/mysql
DATA_HOME=/var/lib/mysql
cat /etc/group|grep "${GROUP}">/dev/null
if [ $? -ne 0 ];then
groupadd ${GROUP}
fi
id mysql >/dev/null 2>&1
if [ $? -ne 0 ];then
useradd -g ${GROUP} ${USER}
fi
ls ${FILE_PATH} |grep -w "^mysql-${VERSION}$">/dev/null
if [ $? -ne 0 ];then
tar -zxvf mysql-${VERSION}.tar.gz
fi
#install cmake
cmakeinst()
{
cmake -version>/dev/null 2>&1
if [ $? -ne 0 ];then
tar -zxf cmake-${CVERSION}.tar.gz
fi
cd ${FILE_PATH}/cmake-${CVERSION}
make
make intall
}
configure()
{
cd ${FILE_PATH}/mysql-${VERSION}
cmake -DCMAKE_INSTALL_PREFIX=${MYSQL_BASE} \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=${DATA_HOME} \
-DMYSQL_TCP_PORT=${PORT} \
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
-DMYSQL_USER=${USER} \
-DDEFAULT_CHARSET=utf8 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_EXAMPLE_STORAGE_ENGINE=1
}
makein()
{
cd ${FILE_PATH}/mysql-${VERSION}
make
make install
}
setup()
{
cp ${MYSQL_BASE}/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
sed -i '/storage-engine/ s/MYISAM/INNODB/' /etc/my.cnf
sed -i '/rehash/ s/no-auto-rehash/auto-rehash/' /etc/my.cnf
cp ${MYSQL_BASE}/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
chown -R ${USER} ${MYSQL_BASE}
chgrp -R ${GROUP} ${MYSQL_BASE}
}
initial()
{
${MYSQL_BASE}/scripts/mysql_install_db \
--defaults-file=/etc/my5.cnf \
--basedir=${MYSQL_BASE} \
--datadir=${DATA_HOME} \
--user=${USER}
chown -R root ${MYSQL_BASE}
chown mysql.mysql -R ${DATA_HOME}
${MYSQL_BASE}/bin/mysqld_safe \
--defaults-file=/etc/my5.cnf \
--basedir=${MYSQL_BASE} \
--datadir=${DATA_HOME} \
--user=${USER} &
cat /etc/profile|grep mysql>/dev/null
if [ $? -ne 0 ];then
echo "export PATH=\$PATH:${MYSQL_BASE}/bin" >>/etc/profile
fi
source /etc/profile
}
#============================
cmakeinst
configure
makein
setup
initial
fi
id mysql >/dev/null 2>&1
if [ $? -ne 0 ];then
useradd -g ${GROUP} ${USER}
fi
ls ${FILE_PATH} |grep -w "^mysql-${VERSION}$">/dev/null
if [ $? -ne 0 ];then
tar -zxvf mysql-${VERSION}.tar.gz
fi
#install cmake
cmakeinst()
{
cmake -version>/dev/null 2>&1
if [ $? -ne 0 ];then
tar -zxf cmake-${CVERSION}.tar.gz
fi
cd ${FILE_PATH}/cmake-${CVERSION}
make
make intall
}
configure()
{
cd ${FILE_PATH}/mysql-${VERSION}
cmake -DCMAKE_INSTALL_PREFIX=${MYSQL_BASE} \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=${DATA_HOME} \
-DMYSQL_TCP_PORT=${PORT} \
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
-DMYSQL_USER=${USER} \
-DDEFAULT_CHARSET=utf8 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_EXAMPLE_STORAGE_ENGINE=1
}
makein()
{
cd ${FILE_PATH}/mysql-${VERSION}
make
make install
}
setup()
{
cp ${MYSQL_BASE}/support-files/my-innodb-heavy-4G.cnf /etc/my.cnf
sed -i '/storage-engine/ s/MYISAM/INNODB/' /etc/my.cnf
sed -i '/rehash/ s/no-auto-rehash/auto-rehash/' /etc/my.cnf
cp ${MYSQL_BASE}/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
chown -R ${USER} ${MYSQL_BASE}
chgrp -R ${GROUP} ${MYSQL_BASE}
}
initial()
{
${MYSQL_BASE}/scripts/mysql_install_db \
--defaults-file=/etc/my5.cnf \
--basedir=${MYSQL_BASE} \
--datadir=${DATA_HOME} \
--user=${USER}
chown -R root ${MYSQL_BASE}
chown mysql.mysql -R ${DATA_HOME}
${MYSQL_BASE}/bin/mysqld_safe \
--defaults-file=/etc/my5.cnf \
--basedir=${MYSQL_BASE} \
--datadir=${DATA_HOME} \
--user=${USER} &
cat /etc/profile|grep mysql>/dev/null
if [ $? -ne 0 ];then
echo "export PATH=\$PATH:${MYSQL_BASE}/bin" >>/etc/profile
fi
source /etc/profile
}
#============================
cmakeinst
configure
makein
setup
initial
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27181165/viewspace-775842/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 安裝mysql5.5MySql
- CMAKE安裝mysql5.5MySql
- mysql5.5的原始碼安裝MySql原始碼
- RedHat 6.4原始碼方式安裝mysql5.5Redhat原始碼MySql
- CentOS安裝MySQL5.5的完整步驟DSITCentOSMySql
- linux64bit下安裝mysql5.5LinuxMySql
- Linux 安裝 mysql 5.5.8(cmake原始碼安裝mysql5.5以上版本)[轉]LinuxMySql原始碼
- Centos5.5中安裝Mysql5.5過程分享CentOSMySql
- linux下編譯安裝mysql5.5以上版本Linux編譯MySql
- Win10安裝Mysql5.5卡住假死怎麼回事 win10系統安裝Mysql5.5卡死未響應如何解決Win10MySql
- mysql5.5資料庫cmake原始碼編譯安裝MySql資料庫原始碼編譯
- MySQL入門學習之——原始碼安裝mysql5.5MySql原始碼
- Linux下原始碼編譯方式安裝MySQL5.5Linux原始碼編譯MySql
- 寶塔皮膚安裝的mysql5.5用命令列kill -9後啟動不了MySql命令列
- LINUX環境下MYSQL5.5原始碼安裝(2012年3月26日更新)LinuxMySql原始碼
- codis安裝 (java 安裝 + zookeeper 安裝 + go 安裝 + codis 安裝JavaGo
- mysql5.5 performance_schema 初探MySqlORM
- centos7 RPM MySQL5.5CentOSMySql
- mysql5.5半同步複製探究MySql
- 安裝npm 解除安裝npm 安裝apidocNPMAPI
- mysql安裝 (yum 安裝)MySql
- MMM安裝、MHA安裝
- mysql5.5的bin資料型別MySql資料型別
- mysql5.5中的半同步複製MySql
- mysql安裝------RPM包安裝及解除安裝MySql
- oracle安裝:OUI安裝Oracle(圖形介面安裝)OracleUI
- ffmpeg安裝之mac安裝Mac
- docker安裝及解除安裝Docker
- 02 安裝git、安裝TortoiseGitGit
- Ubuntu解除安裝和安裝Ubuntu
- Orace RAC安裝-DNS安裝DNS
- caffe安裝系列——安裝OpenCVOpenCV
- SPARK 安裝之scala 安裝Spark
- mac 安裝opencv homebrew安裝MacOpenCV
- Oracle 安裝與解除安裝Oracle
- solaris mysql 安裝 解除安裝MySql
- BiocManager安裝,devtools安裝dev
- JDK安裝和解除安裝JDK