Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Owncloud in Ubuntu 16.04 - Failed to connect to the database: Access denied for user ‘root’@’localhost’ #26110

Closed
tonybluem opened this issue Sep 13, 2016 · 3 comments

Comments

@tonybluem
Copy link

tonybluem commented Sep 13, 2016

Hello,

please excuse my bad english - but I am not a native speaker.

My Problem: After the Dist-Upgrade from Ubuntu 14.04 to 16.04 I get only a white site on the Browser (https://myserver/owncloud/index.php).

Steps to reproduce

  1. try to upgrade owncloud in Ubuntu 14.04 LTS to Ubuntu 16.04 LTS with mysql
  2. or install owncloud on Ubuntu 16.04 LTS with mysql

Expected behaviour

owncloud should connect to mysql

Actual behaviour

Failed to connect to the database: Access denied for user ‘root’@’localhost’

Server configuration

Before the upgrade I run owncloud 9,1,0,15 (owncloud/version.php) + php5 + mysql-server-5.5 (Ubuntu 14.04 LTS). After the dist-upgrade I see owncloud 9.1.0-1.1 (in deselect) + php 7 + mysql-server-5.7-15

Web server: apache2

sudo -u www-data php occ app:list
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in /var/www/owncloud-org/lib/private/DB/Connection.php:58
Stack trace:
#0 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/owncloud-org/lib/private/DB/Connection.php(141): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /var/www/owncloud-org/lib/private/DB/ConnectionFactory.php(120): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /var/www/owncloud-org/lib/private/Server.php(410): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#9 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('DatabaseConnect...')
#10 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#11 /var/www/owncloud-org/lib/private/Server.php(969): OC\ServerContainer->query('DatabaseConnect...')
#12 /var/www/owncloud-org/lib/private/Server.php(215): OC\Server->getDatabaseConnection()
#13 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#14 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\Authenticati...')
#15 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#16 /var/www/owncloud-org/lib/private/Server.php(219): OC\ServerContainer->query('OC\Authenticati...')
#17 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#18 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\Authenticati...')
#19 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#20 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(150): OC\ServerContainer->query('OC\Authenticati...')
#21 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(OC\Server))
#22 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\Authenticati...')
#23 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#24 /var/www/owncloud-org/lib/private/Server.php(234): OC\ServerContainer->query('OC\Authenticati...')
#25 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#26 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('UserSession')
#27 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('UserSession')
#28 /var/www/owncloud-org/lib/private/Server.php(846): OC\ServerContainer->query('UserSession')
#29 /var/www/owncloud-org/lib/private/Server.php(454): OC\Server->getUserSession()
#30 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#31 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('AppManager')
#32 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#33 /var/www/owncloud-org/lib/private/Server.php(1146): OC\ServerContainer->query('AppManager')
#34 /var/www/owncloud-org/lib/private/legacy/app.php(284): OC\Server->getAppManager()
#35 /var/www/owncloud-org/lib/private/legacy/app.php(105): OC_App::getEnabledApps()
#36 /var/www/owncloud-org/lib/base.php(573): OC_App::loadApps(Array)
#37 /var/www/owncloud-org/lib/base.php(967): OC::init()
#38 /var/www/owncloud-org/console.php(50): require_once('/var/www/ownclo...')
#39 /var/www/owncloud-org/occ(11): require_once('/var/www/ownclo...')

The content of config/config.php:

'50f2b69bdd312', 'passwordsalt' => 'XXX', 'datadirectory' => '/var/www/owncloud/data', 'dbtype' => 'mysql', 'version' => '9.1.0.15', 'installed' => true, 'maintenance' => false, 'theme' => '', 'trusted_domains' => array ( 0 => 'gustav.duck', ), 'loglevel' => 0, 'mail_from_address' => 'administrator', 'mail_smtpmode' => 'smtp', 'mail_domain' => 'gustav.duck', 'mail_smtphost' => 'gustav.duck', 'mail_smtpport' => '25', 'secret' => 'XXX', 'dbname' => 'owncloud', 'dbhost' => '127.0.0.1', 'dbuser' => 'root', 'dbpassword' => '', 'updatechecker' => false, 'overwrite.cli.url' => 'http:/gutstav.duck/owncloud', 'memcache.local' => '\OC\Memcache\APCu', sudo -u www-data php occ config:list system An unhandled exception has been thrown: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in /var/www/owncloud-org/lib/private/DB/Connection.php:58 Stack trace: #0 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect() #1 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion() #2 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform() #3 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621): Doctrine\DBAL\Connection->getDatabasePlatform() #4 /var/www/owncloud-org/lib/private/DB/Connection.php(141): Doctrine\DBAL\Connection->setTransactionIsolation(2) #5 /var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager)) #6 /var/www/owncloud-org/lib/private/DB/ConnectionFactory.php(120): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager)) #7 /var/www/owncloud-org/lib/private/Server.php(410): OC\DB\ConnectionFactory->getConnection('mysql', Array) #8 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server)) #9 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('DatabaseConnect...') #10 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...') #11 /var/www/owncloud-org/lib/private/Server.php(969): OC\ServerContainer->query('DatabaseConnect...') #12 /var/www/owncloud-org/lib/private/Server.php(215): OC\Server->getDatabaseConnection() #13 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server)) #14 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\Authenticati...') #15 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...') #16 /var/www/owncloud-org/lib/private/Server.php(219): OC\ServerContainer->query('OC\Authenticati...') #17 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server)) #18 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\Authenticati...') #19 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...') #20 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(150): OC\ServerContainer->query('OC\Authenticati...') #21 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(109): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(Object(OC\Server)) #22 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('OC\Authenticati...') #23 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...') #24 /var/www/owncloud-org/lib/private/Server.php(234): OC\ServerContainer->query('OC\Authenticati...') #25 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server)) #26 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('UserSession') #27 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('UserSession') #28 /var/www/owncloud-org/lib/private/Server.php(846): OC\ServerContainer->query('UserSession') #29 /var/www/owncloud-org/lib/private/Server.php(454): OC\Server->getUserSession() #30 /var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server)) #31 /var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102): Pimple\Container->offsetGet('AppManager') #32 /var/www/owncloud-org/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppManager') #33 /var/www/owncloud-org/lib/private/Server.php(1146): OC\ServerContainer->query('AppManager') #34 /var/www/owncloud-org/lib/private/legacy/app.php(284): OC\Server->getAppManager() #35 /var/www/owncloud-org/lib/private/legacy/app.php(105): OC_App::getEnabledApps() #36 /var/www/owncloud-org/lib/base.php(573): OC_App::loadApps(Array) #37 /var/www/owncloud-org/lib/base.php(967): OC::init() #38 /var/www/owncloud-org/console.php(50): require_once('/var/www/ownclo...') #39 /var/www/owncloud-org/occ(11): require_once('/var/www/ownclo...') ### Logs #### Web server error log ``` less /var/log/apache2/error.log [Tue Sep 13 21:26:57.305944 2016] [core:notice] [pid 5827] AH00094: Command line: '/usr/sbin/apache2' [Tue Sep 13 21:33:13.357819 2016] [authz_core:error] [pid 10986] [client 192.168.1.200:36062] AH01630: client denied by server configuration: /var/www/owncloud/data/htaccesstest.txt The problem was discribed here too: https://central.owncloud.org/t/sqlstate-28000-1045-access-denied-for-user-root-localhost-using-password-yes/2305 ```
@tonybluem
Copy link
Author

Thank you to all.

Here´s the solution:

  1. Produce a MySQL Dump (mysqldump -u username -p --all-databases > dump.sql)
  2. Delete all mysql-packages (dpkg --purge mysql...)
  3. Reinstall mysql

mysql -u root -p

CREATE DATABASE owncloud;
GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'set_database_password';
FLUSH PRIVILEGES;

  1. Restore MySQL Dump (mysql -u username -p database_name < dump.sql)
  2. Backup /var/www/owncloud/config + /var/www/owncloud/data
  3. Delete all owncloud* Packages
  4. Reinstall owncloud
  5. Restore /var/www/owncloud/config + /var/www/owncloud/data from backup

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-owncloud-on-ubuntu-16-04

Thank you!

Tony

@popsy700
Copy link

Good Day to you all I have this error below when I try to install owncloud server on my mac os sierra:

Exception occurred while logging exception: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'veritascloud'
#0 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/DB/Connection.php(145): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/DB/ConnectionFactory.php(146): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/Server.php(493): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#9 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('DatabaseConnect...')
#10 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#11 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/Server.php(1160): OC\ServerContainer->query('DatabaseConnect...')
#12 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/Server.php(370): OC\Server->getDatabaseConnection()
#13 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#14 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('AppConfig')
#15 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppConfig')
#16 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/Server.php(1089): OC\ServerContainer->query('AppConfig')
#17 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/Server.php(547): OC\Server->getAppConfig()
#18 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))
#19 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('AppManager')
#20 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#21 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/Server.php(1359): OC\ServerContainer->query('AppManager')
#22 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/legacy/app.php(346): OC\Server->getAppManager()
#23 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/private/legacy/app.php(110): OC_App::getEnabledApps()
#24 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/base.php(579): OC_App::loadApps(Array)
#25 /Applications/XAMPP/xamppfiles/htdocs/owncloud/lib/base.php(998): OC::init()
#26 /Applications/XAMPP/xamppfiles/htdocs/owncloud/index.php(54): require_once('/Applications/X...')
#27 {main}

@lock
Copy link

lock bot commented Jul 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants