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 -