phpBB 和 mySQL "Could not connect to the database..."

标签 php mysql phpbb

我正在尝试在本地托管的网页上建立一个 phpBB 论坛。它是在 openSUSE Linux 操作系统中完成的。

我已经安装了 MariaDB (MySQL),并使用命令 CREATE DATABASE new_database; 创建了一个名为 new_database 的新数据库,以及一个名为 user< 的用户 使用命令 CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'password';。我还将 root 密码更改为 password,仅用于测试目的。

当我在 phpBB 安装数据库设置屏幕中输入此信息时,出现错误

Could not connect to the database, see error message below.

Access denied for user 'new_user'@'localhost' to database 'new_database'.

我正在为 DSN 使用 localhost。有任何想法吗?从我在网上找到的所有内容来看,它应该可以正常工作...

最佳答案

创建用户后,您必须授予权限,这就是您的操作方式。

GRANT ALL PRIVILEGES ON new_database.* TO 'newuser'@'localhost';

不要忘记冲洗。

FLUSH PRIVILEGES

共同特权

ALL PRIVILEGES- all access
CREATE- allows them to create new tables or databases
DROP- allows them to them to delete tables or databases
DELETE- allows them to delete rows from tables
INSERT- allows them to insert rows into tables
SELECT- allows them to use the Select command to read through databases
UPDATE- allow them to update table rows
GRANT OPTION- allows them to grant or remove other users' privileges

可以指定数据库和表。

new_database.* (Specific Database, all tables)
new_database.table (Specific Database, specific table)
*.* (all databases, al tables)

关于phpBB 和 mySQL "Could not connect to the database...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29529576/

相关文章:

php - 不仅返回小写字母和数字,还返回符号和大写字母的哈希函数

php - mysql查询检查多个非空列

php - Symfony 从 Controller 设置 block 内容

ruby-on-rails - 在 phpBB 和 Rails 应用程序之间共享 session

javascript - WordPress最爱系统无插件学习方法

mysql - 多行COUNT查询

java - 跳过结果集中的 if 条件

php - 监听数据库 Laravel 中的时间戳

没有 php 的 PHPBB3 大量用户删除

mysql - 重用 phpbb 连接向 mysql 添加一条记录