由于是第一次安装,不能确定你是否有安装编译和mysql所要依赖的插件,使用我是当做你最原始的安装环境。
1、安装mysql5.1的依赖包
yum install -y gcc gcc-c++ autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool* openssl*
2、上传mysql的安装包,可以在官方网站下载,注意是要下载源代码。
3、上传到root的根目录
4、开始编译安装mysql5.1
mkdir -p /data/mysql
useradd mysql
chown msyql.mysql /data/mysql
tar -xf mysql-5.1.73.tar.gz
cd mysql-5.1.73.tar.gz
./configure --prefix=/usr/local/mysql --localstatedir=/data/mysql --enable-assembler --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-pthread --enable-static --with-big-tables --without-ndb-debug --with-charset=utf8 --with-extra-charsets=all --without-debug --enable-thread-safe-client --enable-local-infile --with-plugins=max
make && make install
cp support-files/my-huge.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
vi /etc/init.d/mysqld
basedir =/usr/local/mysql
datadir =/data/mysql
chmod +x /etc/init.d/mysqld
chkconfig mysqld --add
chkconfig mysqld on
/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql # 编译完成
service mysqld start
/usr/local/mysql/bin/mysql # 进入数据库