mysql下为数据库设置交叉权限的方法
本文将演示这种情况,并给出详细的解决步骤。
本文示例的配置如下:
Discuz!
数据库名:discuz_7_sc_utf8
数据库用户名:discuz_mysql
权限:操作 discuz_7_sc_utf8 的全部权限
SupeSite/X-space
数据库名:ss_601_xs_401_sc_utf8
数据库用户名:ss_mysql
权限:操作 ss_mysql 的全部权限
出现情况:安装 SupeSite/X-space 时无法检测到 Discuz! 的数据库。
解决方法:授予 ss_mysql 操作 discuz_7_sc_utf8 的全部权限。
如果为了方便,可以创建一个数据库用户,授予该用户操作 Discuz! 和 SupeSite 数据库的全部权限,在安装时,都使用这个数据库用户,就不会出现本文的这种情况。以后安装别的产品,比如 UCenter Home,再授予该用户操作 UCenter Home 数据库的权限即可。
一、安装 Discuz_7.0.0_SC_UTF8
1、在 MySQL 中创建数据库 discuz_7_sc_utf8
打开 phpMyAdmin => 创建一个新的数据库

2、在 MySQL 中创建数据库用户 discuz_mysql,授予操作数据库 discuz_7_sc_utf8 的权限
打开 phpMyAdmin => 权限 => 添加新用户

为了安全,不授予 discuz_mysql 这个用户访问其他数据库的权利,所以全局权限不选。设计完毕,点击“执行”。

跳转到“编辑权限”的页面,“按数据库指定权限”选择“discuz_7_sc_utf8”

在这里,授予数据库用户 discuz_mysql 操作数据库 discuz_7_sc_utf8 的全部权限,如图所示。

3、Discuz_7.0.0_SC_UTF8 的安装设置
在 Discuz! 安装时,输入刚才创建的数据库名、用户名和密码。

二、安装 SupeSite6.0.1_X-Space4.0.1_UC_SC_UTF8
1、在 MySQL 中创建数据库 ss_601_xs_401_sc_utf8

2、在 MySQL 中创建数据库用户 ss_mysql,授予操作数据库 ss_601_xs_401_sc_utf8 的权限


3、SupeSite6.0.1_X-Space4.0.1_UC_SC_UTF8 的安装设置
安装 SuperSite 时,输入刚才创建的数据库名:ss_601_xs_401_sc_utf8,数据库用户名:ss_mysql,以及已安装的论坛 Discuz 的数据库名 discuz_7_sc_utf8,如图所示。

因为刚才只是授予数据库用户 ss_mysql 操作数据库 ss_601_xs_401_sc_utf8 的权限,所以数据库用户 ss_mysql 并没有操作数据库 discuz_7_sc_utf8 的权限,这安装时出现错误,提示“发生错误,您指定的 Discuz!数据库(discuz_7_sc_utf8)不存在,请修正”。

4、授予用户 ss_mysql 操作数据库 discuz_7_sc_utf8 的权限,安装成功
出现这种情况,就需要授予 ss_mysql 操作数据库 discuz_7_sc_utf8 的权限。打开 phpMyAdmin => 权限 => 编辑权限,如图所示。


SupeSite 需要 读取、插入、删除数据库 discuz_7_sc_utf8 中的数据,所以授予用户 ss_mysql 操作数据库 discuz_7_sc_utf8 的全部权限。

授予权限之后,通过安装程序的检测,可以继续安装了。

需要注意的是,如果希望 SupeSite 和 Discuz!同步登录,SupeSite 的 Cookie 设置要和 Discuz! 目录下 config.inc.php 文件中的值相同,如图所示。


现在安装完毕,SupeSite 和 X-space 能够正常显示论坛中的内容。


下一篇:win2003 mysql单向同步配置步骤[已测]