CentOS6.5-Apache-Mysql配置

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对象连接数据库查询时页面出现乱码的问题

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容