zoukankan      html  css  js  c++  java
  • centos配置备忘(apachephpmysql)

    1. 安装apachephpmysql
    =======================================
    yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql

    2. 挂载第二块磁盘/dev/xvdb

    ----------------------------

    fdisk /dev/xvdb
    n
    p
    1
    w

    /dev/xvdb1              /mnt/xvdb1              ext3    defaults        0 0

    ----------------------------


    a)查看硬盘
    fdisk -l

    b)格式化
    mkfs.ext3 /dev/xvdb

    c)建立挂载目录
    mkdir /hf

    d)挂载
    mount /dev/xvdb /hf

    e)确认挂载状况
    df -k -h

    f)开机自动挂载
    vi /etc/fstab
    /dev/xvdb /hf ext3 defaults 1 2

    g)重启机器确认自动挂载状况
    reboot

    h)建立2个目录: data数据库用, website网站用
    mkdir -p /hf/data/mysql
    mkdir -p /hf/website

    3. 配置mysql
    =======================================
    a)修改data目录
    vi /etc/my.cnf
    datadir=/hf/data/mysql

    b)启动mysql
    /etc/rc.d/init.d/mysqld start

    c)修改mysql密码
    /usr/bin/mysqladmin -u root password 'mysql'

    d)登录mysql确认
    mysql -uroot -p

    e)数据库常用操作
    1)创建数据库:
    create database hf;

    2)删除数据库:
    drop database hf;

    3)分配数据库权限
    grant all privileges on hf.* to hf@'localhost' identified by '111111';

    4. 配置apache
    =======================================
    a)开启.htaccess
    vi /etc/httpd/conf/httpd.conf
    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    b)修改默认页
    mkdir -p /hf/website/localhost/htdocs

    vi /hf/website/localhost/htdocs/index.php
    <?php
    echo('hello');
    ?>

    vi /etc/httpd/conf/httpd.conf
    把{ DocumentRoot "/var/www/html" }修改为{ DocumentRoot "/hf/website/localhost/htdocs" }

    c)查看php环境
    vi /hf/website/localhost/htdocs/phpinfo.php
    <?php
    phpinfo();
    ?>

    5. 配置httpdmysql开机自动启动
    =======================================
    chkconfig --add httpd
    chkconfig httpd on

    chkconfig --add mysqld
    chkconfig mysqld on

  • 相关阅读:
    reduce 一知半解(一):根据id合并两个数组
    textarea去除右下角默认样式
    css禁止点击事件
    poj 2723 二分+2-sat判定
    hdu 3062 2-Sat入门
    poj 3694双联通缩点+LCA
    poj 1986LCA离线dfs+并查集
    poj 1330 LCA最近公共祖先
    poj 1882完全背包变形
    poj 1948二维01背包
  • 原文地址:https://www.cnblogs.com/coffee_cn/p/3488602.html
Copyright © 2011-2022 走看看