01- MySQL安装

操作系统:

Red Hat Enterprise Linux 6.6 x86_64



备注:

物理机上部署了一台PXE服务器(RHEL 6.6 x86_64 + http + dhcp + tftp + kickstart + dns),安装的RHEL 6.6里所选择的包为@base,并且提前将光盘配置为本地源。



软件包:

cmake-2.8.10.2.tar.gz

mysql-5.5.33.tar.gz



安装步骤:

#!/bin/bash


# install require packages
yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make


# install cmake
tar xzf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap
make
make install
cmake -version


# install mysql
cd ..
groupadd -g 36 mysql
useradd -M -g mysql -s /sbin/nologin -u 36 mysql
tar xvf mysql-5.5.33.tar.gz
cd mysql-5.5.33
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.33 \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=/usr/local/mysql-5.5.33/data \
-DINSTALL_MANDIR=/usr/share/man \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-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
make
make install

# configure mysql
chown -R mysql:mysql /usr/local/mysql-5.5.33
ln -s /usr/local/mysql-5.5.33 /usr/local/mysql
chmod 755 ./scripts/mysql_install_db
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
cp support-files/my-huge.cnf /etc/my.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile


你可能感兴趣的:(mysql,安装)