mkdir -p /db/mysql
mkdir -p /usr/local/mysql
mkdir -p /usr/local/mysql/var
mkdir -p /usr/local/mysql/data && mkdir -p /usr/local/mysql/run && mkdir -p /usr/local/mysql/log && mkdir -p /usr/local/mysql/var
useradd -s /sbin/nologin mysql
chown -R mysql.mysql /db/mysql/
chown -R mysql.mysql /usr/local/mysql/
yum install -y gcc yum install -y gcc-c++ yum -y install ncurses* yum install -y libtermcap*
./configure --enable-thread-safe-client --enable-assembler --with-server-suffix =" for >>>MySQL Database of Zebra by Yhc<<<" --without-debug --with-extra-charsets=complex --prefix=/usr/local/mysql
make -j 12 && make install
#添加PATH echo "PATH="/usr/local/mysql/bin:$PATH"" >> /etc/profile && export PATH="/usr/local/mysql/bin:$PATH"
#strip可执行文件 strip /usr/local/mysql/libexec/mysqld
#添加LIB PATH echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf && ldconfig
#将my.cnf文件cp到/etc目录下
/bin/cp -r /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf && chown mysql:mysql /etc/my.cnf
sed -i 's/skip-federated/#skip-federated/' /etc/my.cnf
cd /usr/local/mysql/bin
ln -s ./mysql ./test_mysql
ln -s ./mysqladmin ./adminmysql
ln -s ./mysql_install_db ./install_db_mysql
ln -s ./mysqld_safe ./safe_mysqld
#初始化Mysql表 cd /usr/local/mysql/bin ./install_db_mysql --user=mysql 或者 ./mysql_install_db --user=mysql --datadir=/db/mysql/
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chown -R root /usr/local/mysql && chown -R mysql /usr/local/mysql/var && chgrp -R mysql /usr/local/mysql