#具体可以参考目录下的INSTALL-BINARY文件
#安装mysql,将mysql压缩解压到/usr/local
tar zxvf mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar.gz -C /uar/local/
cd /usr/local
ln -s mysql-advanced-5.6.23-linux-glibc2.5-x86_64 mysql
cd mysql
#添加mysql用户和群组
groupadd mysql
useradd -r -g mysql mysql
#修改相关目录和文件属主和所属群组
chown -R mysql .
chgrp -R mysql .
或者:chown -R mysql:mysql .
#将目录属主更改为root,避免mysql用户将目录删除
chown -R root .
chown -R mysql data
#安装依赖包
yum -y install libaio-devel perl-Module-Install.noarch
#使用mysql用户权限来初始化数据库
scripts/mysql_install_db --user=mysql
#将mysql添加为服务
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
#将mysql的bin目录加入到PATH环境变量
#在/etc/profile最后面添加
PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
#脚本初始化已经添加mysqld脚本,如果没有直接cp /etc/init.d/mysqld
/etc/rc.d/init.d/mysqld
#启动mysql
/usr/local/mysql/bin/mysqld_safe &
#建立软连接
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
#或者在/etc/my.cnf修改
socket=/tmp/mysql.sock
#修改mysql root 密码
/usr/local/mysqladmin -u root -p password love --socket=/var/lib/mysql/mysql.sock
#修改nginx.conf配置文件
server
{
listen 80;
server_name www.postfix.local;
access_log logs/lanp.log;
location /
{
root html/lanp;
index index.php index.html;
}
location ~ \.php$
{
root html/lanp;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
#修改php
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
#启动php-fpm,默认监控127.0.0.1:9000
/usr/local/php/sbin/php-fpm
#查看是否已经启动
lsof -i:9000
netstat -tnlp | grep 9000
#图示,所有以".php"请求交由127.0.0.1:9000处理,即php-fpm进程处理
#读取mysql user表内容并在网页止显示
# index.php文件内容
<?php
$con=mysql_connect("localhost","root","love");
$sql="select user,password from user";
$db_select=mysql_select_db("mysql",$con);
$result=mysql_query($sql,$con);
while ($row=mysql_fetch_array($result))
{
echo $row["user"]." ".$row["password"];
echo "<br/>";
}
mysql_close($con);
?>
#显示结果