1 安装依赖库和创建用户
yum install ncurses-devel -y
useradd -M -s /sbin/nologin mysql
2 解压文件及安装
tar zxvf mysql-5.1.73.tar.gz
cd mysql-5.1.73
./configure --prefix=/usr/local/mysql
make
make install
3 设置目录访问权限和拷贝配置及启动文件
chown -R mysql.mysql /usr/local/mysql/
cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R root /usr/local/mysql/
chown -R mysql /usr/local/mysql/var/
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig mysqld on
4 加入环境变量
echo ‘PATH=/usr/local/mysql/bin/:$PATH‘ >>/etc/profile
source /etc/profile
时间: 2024-10-12 15:09:33