MySQL安装
yum install -y perl-Module-Install.noarch
cd /usr/local/src
tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
cd /usr/local/mysql
useradd -s /sbin/nologin mysql
mkdir -p /data/mysql; chown -R mysql:mysql /data/mysql
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
vim /etc/init.d/mysqld
定义basedir和datadir
需要修改的地方有 “datadir=/data/mysql” (前面初始化数据库时定义的目录)
/etc/init.d/mysqld start
chkconfig --add mysqld
chkconfig mysqld on
再将路径 /usr/local/mysql/bin 加入到环境变量 /etc/profile里面