Home  >  Article  >  Backend Development  >  How to install mysql php on centos7

How to install mysql php on centos7

藏色散人
藏色散人Original
2020-11-10 09:41:581805browse

How to install mysql php in centos7: first download and install mysql-server from the official website; then use the "systemctl start mysql" command to start mysql; then use the yum command to install php7; finally install and start php-fpm.

How to install mysql php on centos7

# Recommended: "

PHP Video Tutorial

Official website download and install mysql-server

Use the following three commands to install in sequence

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpmrpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server

The installation process is as shown below

How to install mysql php on centos7

How to install mysql php on centos7

How to install mysql php on centos7

After successful installation, use the

systemctl start mysql command to start mysql

How to install mysql php on centos7

As can be seen from the above picture, the initial installation of mysql root account does not have a password

Let’s

set the root account password Use the command set password for 'root'@' localhost' =password('password');

As shown below, we set the root account password to 123456 and logged in successfully

How to install mysql php on centos7

How to install mysql php on centos7

Set up mysql remote connection

Give all database permissions to the root account

grant all privileges on *.* to root@'%'identified by 'password';

If it is a new user instead of root, you must first create a new user

create user 'username'@'%' identified by 'password';

Flush privileges

flush privileges;

How to install mysql php on centos7

This way our mysql database is configured and we can connect remotely


Download php7

    Install php7
  • rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

How to install mysql php on centos7

##Use yum command to install php7
  • yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64

How to install mysql php on centos7

Install php-fpm and start
  • yum install php70w-fpm php70w-opcache

How to install mysql php on centos7Start php-fpm

systemctl start php-fpm

Test Whether php and php-fpm are installed successfully
  • Create a new index.php in the nginx root directory with the following content

How to install mysql php on centos7

How to install mysql php on centos7Access your web server and the following picture will appear, indicating that the installation is successful

How to install mysql php on centos7

The above is the detailed content of How to install mysql php on centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn