MySQL ownCloud 设置:SQLSTATE[HY000][1045] 用户 'owncloud'@localhost' 访问被拒绝(使用密码:YES)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37702595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:51:31  来源:igfitidea点击:

ownCloud Setup: SQLSTATE[HY000][1045] Access denied for user 'owncloud'@localhost' (using password:YES)

mysqlowncloud

提问by user2509663

I wanted to setup my owncloud installation on my raspberry pi 2. So, I created an mysql database and user.

我想在我的 raspberry pi 2 上设置我自己的云安装。所以,我创建了一个 mysql 数据库和用户。

CREATE DATABASE owncloud;

CREATE USER 'owncloud'@'localhost' IDENTIFIED BY 'Password';
GRANT ALL PRIVILEGES ON owncloud. * TO 'owncloud'@'localhost';
FLUSH PRIVILEGES;

After I type all nessesairy parameters into the webinterface of the owncloud-setup, I recevied:

在我将所有必要的参数输入到 owncloud-setup 的网络界面后,我收到了:

Error while trying to create admin user: Failed to connect the database: An exeption occured in driver: SQLSTATE[HY000][1045] Access denied for user 'owncloud'@'localhost' (using password:YES)

尝试创建管理员用户时出错:无法连接数据库:驱动程序中发生异常:SQLSTATE[HY000][1045] 用户'owncloud'@'localhost' 访问被拒绝(使用密码:YES)

Sadly, my resent sreach on similar topics didn't result in any functional hint on this problem. So, I would be happy about further suggestions.

可悲的是,我对类似主题的怨恨并没有导致对这个问题的任何功能提示。因此,我很乐意提供进一步的建议。

采纳答案by Thomas Kühnert

  1. Look at this: https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#database-choice
  2. In Terminal: mysql_upgrade --force -u root -p
  3. Use administrative MySQL ?root?-user and password with the Installation Wizard
  4. Check that the Database not exist which you create with the Installation Wizard
  5. If nothing helps, start with sqlite, then migrate to mysql like this: https://doc.owncloud.org/server/9.0/admin_manual/configuration_database/db_conversion.html
  1. 看看这个:https: //doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#database-choice
  2. 在终端:mysql_upgrade --force -u root -p
  3. 在安装向导中使用管理 MySQL ?root?-用户和密码
  4. 检查您使用安装向导创建的数据库不存在
  5. 如果没有任何帮助,从 sqlite 开始,然后像这样迁移到 mysql:https: //doc.owncloud.org/server/9.0/admin_manual/configuration_database/db_conversion.html

回答by Ilya Rusin

Just replace localhostfor 127.0.0.1in Owncloud's setup form for MySQL as mentioned in comments above by Askaga

正如Askaga 在上面的评论中提到的,只需在 Owncloud 的 MySQL 设置表单中替换localhostfor127.0.0.1

回答by HDK Bouma

Ubuntu 18.04.1, Owncloud 10.

Check the contents of config.phpin my case located at /var/www/owncloud/config/. Specialy items dbuserand dbpasswrd. Read config.sample.phpin the same directory for info.

config.php在我的案例中检查位于 的内容/var/www/owncloud/config/。特殊物品dbuserdbpasswrdconfig.sample.php在同一目录中阅读信息。

回答by Wesley

For some reason, explicitlyre-access the database from the terminal solves the problem for me. Just give mysql an empty line with

出于某种原因,从终端显式地重新访问数据库为我解决了这个问题。只需给 mysql 一个空行

mysql -u root -e ";"

This should be an individual command afteryou created database and database user.

这应该是您创建数据库和数据库用户的单独命令。

Sure, you should always check whether

当然,你应该经常检查是否

  1. There are users with an empty username. Remove them.

  2. Remove "test" database.

  3. Grant appropriate permission to your database user.

  4. Last but not least FLUSH PRIVILEGES;.

  1. 有用户名为空的用户。删除它们。

  2. 删除“测试”数据库。

  3. 向您的数据库用户授予适当的权限。

  4. 最后但并非最不重要的FLUSH PRIVILEGES;

Search other posts for instructions. I'm just providing a possible solution if you come across a situation where none of the above works.

搜索其他帖子以获取说明。如果您遇到上述方法均无效的情况,我只是提供一个可能的解决方案。

Here's a good example to properly setup mysql after installation. FYI.

是在安装后正确设置 mysql 的一个很好的例子。供参考。

回答by Thomas Eichhorst

Mask the DB password in the installation screen (the password should not be visible, only dots) and retry.

在安装屏幕中屏蔽 DB 密码(密码不应该是可见的,只有点)并重试。