1.使用阿里云服務(wù)更新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 //查看是否已經(jīng)安裝Apache
yum install httpd //安裝Apache服務(wù)
service httpd start //啟動(dòng)Apache服務(wù)
service httpd status //查看Apache服務(wù)狀態(tài)
3.安裝Mysql(CentOS6.5 暫不支持MariaDB)
yum install mysql mysql-server??//安裝mysql
/etc/init.d/mysqld start??//啟動(dòng)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;//修改權(quán)限
4.安裝php以及php拓展
yum install php php-fpm php-bcmatch php-gd php-mbstring php-mcrypt php-mysql
service httpd restart //重啟Apache服務(wù)
ps:1.mysql服務(wù)重啟 /etc/init.d/mysqld restart
2.字符集編碼問(wèn)題去配置文件中更改,/etc/my.cnf
3.$conn=new PDO('mysql:host=localhost;dbname=tpshop','root','370766',array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
解決PDO對(duì)象連接數(shù)據(jù)庫(kù)查詢時(shí)頁(yè)面出現(xiàn)亂碼的問(wèn)題