美文网首页我爱编程@IT·互联网
CentOS6.5-Apache-Mysql配置

CentOS6.5-Apache-Mysql配置

作者: ancherl | 来源:发表于2017-05-18 14:10 被阅读0次

    1.使用阿里云服务更新yum资源

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

    yum makecache

    2.安装Apache

    apachectl -v //查看是否已经安装Apache

    yum install httpd //安装Apache服务

    service httpd start //启动Apache服务

    service httpd status //查看Apache服务状态

    3.安装Mysql(CentOS6.5 暂不支持MariaDB)

    yum install mysql mysql-server  //安装mysql

    /etc/init.d/mysqld start  //启动mysql

    use mysql;//使用mysql表

    update user set password=PASSWORD('NEW PASSWORD') where user='root';//修改root密码

    flush privileges;//刷新生效

    quit;

    mysql -u root -p //重新登陆(用新密码)

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'NEWPASSWORD' WITH GRANT OPTION;//修改权限

    4.安装php以及php拓展

    yum install php php-fpm php-bcmatch php-gd php-mbstring php-mcrypt php-mysql

    service httpd restart //重启Apache服务

    ps:1.mysql服务重启 /etc/init.d/mysqld restart

    2.字符集编码问题去配置文件中更改,/etc/my.cnf

    3.$conn=new PDO('mysql:host=localhost;dbname=tpshop','root','370766',array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));

    解决PDO对象连接数据库查询时页面出现乱码的问题

    相关文章

      网友评论

        本文标题:CentOS6.5-Apache-Mysql配置

        本文链接:https://www.haomeiwen.com/subject/xvesxxtx.html