Linux下构建LAMP架构

yum install httpd httpd-devel mysql-server mysql-devel php php-devel php-mysql -y




[[email protected] ~]# /etc/init.d/httpd start




[[email protected] ~]# /etc/init.d/mysqld start


在安装MySQL后,启动时候没有启动成功,查看了下日志报错如下:
---------------------------------------------


[[email protected] local]# less /var/log/mysqld.log


1、查看报错信息如下:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist


然后试了下单独的命令,启动完成
mysql_install_db


启动mysql服务
[[email protected] mysqld]# /etc/init.d/mysqld restart
停止 mysqld:                                              [确定]
正在启动 mysqld:                                          [确定]


[[email protected] ~]# cd /var/www/html/


[[email protected] html]# vi index.php  
<?php 
phpinfo();
?>

[[email protected] html]# cd /etc/httpd/conf.d/

源码安装DISCUZ论坛
下载discuz源码包文件,然后解压:
[[email protected] local]# wget http://download.comsenz.com/DiscuzX/3.1/Discuz_X3.1_SC_UTF8.zip
解压discuz程序包:unzip Discuz_X3.1_SC_UTF8.zip -d /var/www/html/
重命名程序文件:cd /var/www/html/

mv upload/* .

/etc/init.d/httpd restart

在浏览器中输入:http://192.168.140.132/,会弹出如下图:

Linux下构建LAMP架构

然后选择“我同意”

Linux下构建LAMP架构

会看到当前状态不可写,是没有权限,赋予discuz目录完全访问权限:cd /var/www/html/;

[[email protected] html]# chmod 777 -R data/ uc_server/ config/ uc_client/


点击下一步,如下图

Linux下构建LAMP架构

点击下一步

Linux下构建LAMP架构

进入mysql,执行:mysql


然后进入mysql数据库,执行:use msyql 


修改密码即可:


update user set password=password("123456") where user="root";

如果修改密码不成功

Mysql 忘记密码如何**:

首行关闭mysql进程,然后输入命令:mysqld_safe --skip-grant-tables & 跳过密码

mysql> create database discuz;
Query OK, 1 row affected (0.00 sec)


mysql> grant all on discuz.* to [email protected]'localhost' identified by "123456";

Query OK, 0 rows affected (0.00 sec)


启动:/etc/init.d/mysqld restart

Linux下构建LAMP架构

Linux下构建LAMP架构