# vi /etc/profile #最后一行添加以下两行: export MYSQL_HOME=/usr/local/mysql export PATH=$PATH:$MYSQL_HOME/bin #保存退出 source /etc/profile
11、修改root密码
mysql -uroot -p mysql SET password=PASSWORD("123456");
12、设置开机自启
chkconfig --add mysqld chkconfig mysqld on
三、安装PHP
1、安装依赖库——libmcrypt
# wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz # tar zxvf libmcrypt-2.5.8.tar.gz # cd libmcrypt-2.5.8/ # ./configure # make && make install # /sbin/ldconfig # cd libltdl/ # ./configure --enable-ltdl-install # make && make install # ln -sf /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la # ln -sf /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so # ln -sf /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 # ln -sf /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 # ldconfig
2、安装依赖库——mhash
# wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz # tar zxvf mhash-0.9.9.9.tar.gz # cd mhash-0.9.9.9/ # ./configure # make && make install # ln -sf /usr/local/lib/libmhash.a /usr/lib/libmhash.a # ln -sf /usr/local/lib/libmhash.la /usr/lib/libmhash.la # ln -sf /usr/local/lib/libmhash.so /usr/lib/libmhash.so # ln -sf /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 # ln -sf /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 # ldconfig
3、安装依赖库——mcrypt
# wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz # tar zxvf mcrypt-2.6.8.tar.gz # cd mcrypt-2.6.8/ # ./configure # make && make install
4、下载PHP安装包
wget -O php-7.1.10.tar.gz http://hk1.php.net/get/php-7.1.10.tar.gz/from/this/mirror
5、解压安装包
# tar -zxf php-7.1.10.tar.gz
# cd php-7.1.10
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts --enable-opcache --with-xsl
或者
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts --with-libdir=lib64
# make && make install
6、修改配置文件