CentOS安装PHP和mysql

Posted 小春熙子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS安装PHP和mysql相关的知识,希望对你有一定的参考价值。

新生在不会编译的情况下:

1、安装php5

yum install php
根据提示输入Y直到安装完成
2、安装PHP组件,使 PHP5 支持 mysql
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
 
2.安装Mysql:
**第一次安装时出现:
 

[[email protected]_18_87_centos ~]# service mysql start
Redirecting to /bin/systemctl start mysql.service
Failed to start mysql.service: Unit mysql.service failed to load: No such file or directory.

[[email protected]_18_87_centos mysql-5.5.3-m3]# service mysql status
Redirecting to /bin/systemctl status mysql.service
* mysql.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

 

**在网上发现解决办法:

sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

 

**然后移除已安装的Mysql后,再次安装:

yum install  mysql mysql-server mysql-libs mysql-server

 

最后重启Mysql服务:

 

[[email protected]_18_87_centos ~]# service mysql start
Redirecting to /bin/systemctl start mysql.service

 

可以啦:

[[email protected]_18_87_centos ~]# service mysql status
Redirecting to /bin/systemctl status mysql.service
* mysqld.service - MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2016-11-20 16:02:08 CST; 3s ago
Process: 16986 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 16923 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 16985 (mysqld_safe)
CGroup: /system.slice/mysqld.service
|-16985 /bin/sh /usr/bin/mysqld_safe
`-17139 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-...

Nov 20 16:02:07 VM_18_87_centos mysql-systemd-start[16923]: Support MySQL by buying s...
Nov 20 16:02:07 VM_18_87_centos mysql-systemd-start[16923]: Note: new default config ...
Nov 20 16:02:07 VM_18_87_centos mysql-systemd-start[16923]: Please make sure your con...
Nov 20 16:02:07 VM_18_87_centos mysql-systemd-start[16923]: WARNING: Default config f...
Nov 20 16:02:07 VM_18_87_centos mysql-systemd-start[16923]: This file will be read by...
Nov 20 16:02:07 VM_18_87_centos mysql-systemd-start[16923]: If you do not want to use...
Nov 20 16:02:07 VM_18_87_centos mysql-systemd-start[16923]: --defaults-file argument ...
Nov 20 16:02:07 VM_18_87_centos mysqld_safe[16985]: 161120 16:02:07 mysqld_safe Logg....
Nov 20 16:02:07 VM_18_87_centos mysqld_safe[16985]: 161120 16:02:07 mysqld_safe Star...l
Nov 20 16:02:08 VM_18_87_centos systemd[1]: Started MySQL Community Server.
Hint: Some lines were ellipsized, use -l to show in full.

 

 

 




























以上是关于CentOS安装PHP和mysql的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7.2下服务器配置(linux+apache+php+mysql)

Centos 6.6 下 nginx +php mysql + phpMyadmin 安装部署

centos7 服务器安装nginx,mysql,php

CentOS 下安装 LEMP 服务(NginxMariaDB/MySQL 和PHP)

CentOS 下安装 LEMP 服务(nginxMariaDB/MySQL 和 php)

CentOS源码安装搭建LNMP全过程(包括nginx,mysql,php,svn)转