- #!/bin/bash
- #mysql 依賴
- yum -y install gcc make gcc-c++ ncurses-devel openssl-devel
- wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mysql.he.net/
- wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
- wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
- tar zxvf cmake-2.8.5.tar.gz
- cd cmake-2.8.5
- ./bootstrap
- gmake
- gmake install
- cd ../
- tar zxvf bison-2.5.tar.gz
- cd bison-2.5
- ./configure
- make
- make install
- cd ../
- groupadd mysql
- useradd -g mysql mysql
- tar zxvf mysql-5.5.15.tar.gz
- cd mysql-5.5.15
- cmake . \
- -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
- -DMYSQL_DATADIR=/var/mysql/data \
- -DMYSQL_TCP_PORT=3306 \
- -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
- -DDEFAULT_CHARSET=utf8 \
- -DDEFAULT_COLLATION=utf8_general_ci \
- -DWITH_MYISAM_STORAGE_ENGINE=1 \
- -DWITH_INNOBASE_STORAGE_ENGINE=1
- make & make install
- mv /etc/my.cnf /etc/my.cnf-`date +%F`
- mkdir -p /usr/local/mysql/etc
- cp support-files/my-medium.cnf /usr/local/mysql/etc/my.cnf
- mkdir -p /data/mysql/
- cd /usr/local/mysql/
- chmod 755 scripts/mysql_install_db
- chown mysql.mysql -R /usr/local/mysql/
- chown mysql.mysql -R /data/mysql/
- ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/
- cp support-files/mysql.server /etc/init.d/mysqld
- chmod 755 /etc/init.d/mysqld
- chkconfig mysqld on
- chkconfig --list mysqld
- echo pathmunge /usr/local/mysql/bin after > /etc/profile.d/mysql.sh
- /etc/profile
- /etc/init.d/mysqld start
- service mysqld restart