linux下部署php项目-Apache、php、mysql关联

本文介绍了在Linux系统中如何部署PHP项目,包括使用Apache、PHP和MySQL的压缩包安装或通过yum命令安装。重点讲述了配置MySQL、Apache和PHP之间的关联,以及如何修改MySQL权限以允许远程访问。最后,通过创建测试页面验证PHP环境配置成功。
摘要由CSDN通过智能技术生成

linux下部署php项目-Apache、php、mysql关联

  linux下部署php项目环境可以分为两种,一种使用Apache,php,mysql的压缩包安装,一种用yum命令进行安装。

使用三种软件的压缩包进行安装,需要手动配置三者之间的关系。apache和php之间的配置没有什么难度,但是和mysql进行配置的时候就需要对php的了解了。

以下是用yum在linux中配置php环境:

 

MySql

 

  1.mysql和apache最好是首先进行安装的,因为在配置php的时候需要与mysql和apache进行关联配置和测试

首先下载mysql-sever文件,因为博主linux环境是CentOS版本,yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载

1.下载mysql-service文件
[root@tele-1 ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2.安装
mysql-service文件
[root@tele-1 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm

 

   2.安装mysql

[root@tele-1 ~]# yum install mysql-community-server

 

   3.安装完毕之后启动mysql服务

[root@tele-1 ~]# service mysqld restart

 

  4. 初步安装的mysql是没有密码的,用户名默认是root。所以我们需要修改密码,用mysql命令行进行修改

 1.进入mysql命令行

[root@tele-1 ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 474801
Server version: 5.6.36 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

2.使用命令进行密码修改
mysql> set password for 'root'@'localhost' = password('你要修改的密码');
Query OK, 0 rows affected (0.06 sec)

 

  5.因为博主是用本地navicat软件来连接linux下的mysql的,所以如果要在本地访问的话,就需要改一下mysql数据库中的user表了

1.操作mysql数据库表
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值