安装必备的软件
yum install ncurses-devel -y
yum install pcre pcre-devel -y
yum install gcc* -y
解压缩
tar -zxvf mysql-5.1.72.tar.gz
创建目录
mkdir /application/mysql5.1.72/{data,tmp} -p
chown -R mysql:mysql /application
编译MySQL
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
#--with-plugin-PLUGIN \
make && make install
创建软连接
ln -s /application/mysql5.1.72/ /application/mysql
cp support-files/my-small.cnf /etc/my.cnf
创建mysql用户
groupadd mysql
useradd -g mysql mysql
echo "oracle" |passwd --stdin mysql
创建数据文件目录
mkdir /application/mysql/data -p
chown -R mysql:mysql /application/mysql
初始化过程
/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
如果没有出现错误(出现Waring可以),并且出现两个OK,说明初始化成功。
添加/application/mysql/bin到环境变量
export PATH=/application/mysql/bin:$PATH