我正在尝试在本地托管的网页上建立一个 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/