user2509663
user2509663

Reputation: 179

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

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

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:

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)

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.

Upvotes: 7

Views: 35750

Answers (5)

HDK Bouma
HDK Bouma

Reputation: 1

Ubuntu 18.04.1, Owncloud 10.

Check the contents of config.php in my case located at /var/www/owncloud/config/. Specialy items dbuser and dbpasswrd. Read config.sample.php in the same directory for info.

Upvotes: 0

franchb
franchb

Reputation: 1204

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

Upvotes: 2

Thomas Eichhorst
Thomas Eichhorst

Reputation: 1

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

Upvotes: 0

Wesley
Wesley

Reputation: 539

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

mysql -u root -e ";"

This should be an individual command after you 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;.

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.

Upvotes: 0

Thomas Kühnert
Thomas Kühnert

Reputation: 56

  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

Upvotes: 2

Related Questions