- cd /usr/local/src
- if [ ! -f cmake-2.8.4.tar.gz ];then wget -c http://***1.zhaizu.com/cmake-2.8.4.tar.gz;fi
- tar zxvf cmake-2.8.4.tar.gz
- cd cmake-2.8.4
- ./configure
- make
- make install
- cd /usr/local/src
- if [ ! -f mysql-5.5.10.tar.gz ];then wget -c http://***1.zhaizu.com/mysql-5.5.10.tar.gz;fi
- tar zxvf mysql-5.5.10.tar.gz
- cd mysql-5.5.10
- /usr/local/bin/cmake . \
- -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \
- -DCOMMUNITY_BUILD:BOOL=ON \
- -DENABLED_PROFILING:BOOL=ON \
- -DENABLE_DEBUG_SYNC:BOOL=OFF \
- -DINSTALL_LAYOUT:STRING=STANDALONE \
- -DMYSQL_DATADIR:PATH=/data/mysqldata \
- -DMYSQL_MAINTAINER_MODE:BOOL=OFF \
- -DWITH_EMBEDDED_SERVER:BOOL=ON \
- -DWITH_EXTRA_CHARSETS:STRING=all \
- -DWITH_SSL:STRING=bundled \
- -DWITH_UNIT_TESTS:BOOL=OFF \
- -DWITH_ZLIB:STRING=bundled \
- -DWITH_INNOBASE_STORAGE_ENGINE=1 \
- -DWITH_COMMENT=dancebear \
- -DDEFAULT_CHARSET=utf8 \
- -DDEFAULT_COLLATION=utf8_general_ci \
- -LH
- make && make install
- /usr/sbin/groupadd mysql
- /usr/sbin/useradd -g mysql mysql
- cd /usr/local/mysql
- /bin/mkdir -p /usr/local/mysql/conf
- /bin/mkdir -p /usr/local/mysql/var
- cd /usr/local/mysql
- \cp support-files/my-huge.cnf conf/my.cnf
- if [ -f /etc/my.cnf ];then \cp /etc/my.cnf /etc/my.cnf.bak && cd /etc && rm -f /etc/my.cnf && wget http://***1.zhaizu.com/my.cnf;else cd /etc && wget http://***1.zhaizu.com/my.cnf;fi
- /bin/chmod 775 /etc/my.cnf
- chown root:mysql /etc/my.cnf
- chown -R root:mysql /usr/local/mysql
- /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysqldata --skip-name-resolve --user=mysql --defaults-file=/usr/local/mysql/conf/my.cnf --pid-file=/usr/local/mysql/var/mysql.pid --socket=/usr/local/mysql/var/mysql.sock
- if [ -L /usr/bin/mysqldump -o -f /usr/bin/mysqldump ];then rm -f /usr/bin/mysqldump && ln -s /usr/local/mysql/bin/mysqldump /usr/bin/;else ln -s /usr/local/mysql/bin/mysqldump /usr/bin/;fi
- if [ -L /usr/bin/mysqladmin -o -f /usr/bin/mysqladmin ];then rm -f /usr/bin/mysqladmin && ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/;else ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/;fi
- if [ -L /usr/bin/mysql -o -f /usr/bin/mysql ];then rm -f /usr/bin/mysql && ln -s /usr/local/mysql/bin/mysql /usr/bin/;else ln -s /usr/local/mysql/bin/mysql /usr/bin/;fi
- if [ -L /usr/bin/mysql.server -o -f /usr/bin/mysql.server ];then rm -f /usr/bin/mysql.server && ln -s /usr/local/mysql/bin/mysql.server /usr/bin/;else ln -s /usr/local/mysql/bin/mysql.server /usr/bin/;fi
- if [ -L /usr/bin/mysqld_safe -o -f /usr/bin/mysqld_safe ];then rm -f /usr/bin/mysqld_safe && ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/;else ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/;fi
- #\cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
- if [ -f /etc/init.d/mysqld ];then \cp /etc/init.d/mysqld /etc/init.d/mysqld.bak && cd /etc/init.d && rm -f /etc/init.d/mysqld && wget http://***1.zhaizu.com/mysqld;else cd /etc/init.d && wget http://***1.zhaizu.com/mysqld;fi
- chmod 755 /etc/init.d/mysqld
- chown root:mysql /etc/init.d/mysqld
- chkconfig mysqld on
- ##修改配置文件/etc/init.d/mysqld,添加安装mysql的路径
- #sed -i '46s#.*#basedir=/usr/local/mysql#g' /etc/init.d/mysqld
- #sed -i '47s#.*#datadir=/data/mysqldata#g' /etc/init.d/mysqld
- #sed -i '63s#.*# mysqld_pid_file_path=/data/mysqldata/localhost.pid#g' /etc/init.d/mysqld
- ##可以使用以下命令启停mysql服务或查看当前mysql服务状态
- /etc/init.d/mysqld start
- /etc/init.d/mysqld status
- /etc/init.d/mysqld stop
- if [ -d /usr/local/tomcat/bin ];then
- cd /usr/local/tomcat/bin
- if [ -f reload.sh ];then rm -f reload.sh;fi
- wget http://***1.zhaizu.com/reload.sh
- fi