前端外刊评论 2017-10-05
[TOC]
#httpd服务器搭建discuz
##第一步、数据库的配置
```shell
create database discuz;
grant all privileges on discuz.* to 'discuz'@'localhost' identified by "admin123";
grant all privileges on discuz.* to 'discuz'@'127.0.0.1' identified by "admin123";
grant all privileges on discuz.* to 'discuz'@'192.168.%' identified by "admin123";
flush privileges;
```
##第二步、discuz配置文件相关配置
> upload/config/config_global_default.php
```shell
$_config['db'][1]['dbhost'] = 'localhost';
$_config['db'][1]['dbuser'] = 'discuz';
$_config['db'][1]['dbpw'] = 'admin123';
$_config['db'][1]['dbcharset'] = 'utf8';
$_config['db'][1]['pconnect'] = 0;
$_config['db'][1]['dbname'] = 'discuz';
$_config['db'][1]['tablepre'] = 'pre_';
```
upload/config/config_ucenter_default.php
```shell
define('UC_CONNECT', 'mysql'); // 连接 UCenter 的方式: mysql/NULL, 默认为空时为 fscoketopen(), mysql 是直接连接的数据库, 为了效率, 建议采用 mysql
// 数据库相关 (mysql 连接时)
define('UC_DBHOST', 'localhost'); // UCenter 数据库主机
define('UC_DBUSER', 'discuz'); // UCenter 数据库用户名
define('UC_DBPW', 'admin123'); // UCenter 数据库密码
define('UC_DBNAME', 'discuz'); // UCenter 数据库名称
define('UC_DBCHARSET', 'utf8'); // UCenter 数据库字符集
define('UC_DBTABLEPRE', '`ucenter`.uc_'); // UCenter 数据库表前缀
define('UC_DBCONNECT', '0'); // UCenter 数据库持久连接 0=关闭, 1=打开
```
> 给一些文件增加写权限
```shell
chmod 757 -R config data uc_server uc_client
```