- 下载和解压mysql数据库
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.4-m14-linux-glibc2.5-x86_64.tar.gz
tar -xvf mysql-5.7.4-m14-linux-glibc2.5-x86_64.tar.gz -C /usr/local/mysql-5.7.4
2.创建mysql用户和修改软件的权限
useradd -r -M -s /sbin/nologin mysql
chown -R mysql /usr/local/mysql-5.7.4
chgrp -R mysql /usr/local/mysql-5.7.4
3.安装和初始化数据库
cd /usr/local/mysql-5.7.4/
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.7.4/ --datadir=/usr/local/mysql-5.7.4/data/ --必须在mysql根目录安装mysql,否则出错
cp -a ../support-files/my-default.cnf /etc/my.cnf
cp -a ../support-files/mysql.server /etc/init.d/mysqld
cd bin/
./mysqld_safe --user=mysql &
chkconfig --add mysql
[[email protected] scripts]# /etc/init.d/mysqld restart
Shutting down MySQL.. [ OK ]
Starting MySQL... [ OK ]
[[email protected] scripts]#