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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Anton Blau
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).

How can I repar this?




      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 <https://github.com/owncloud/core/pull/1>
/var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389):
Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 <https://github.com/owncloud/core/issues/2>
/var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328):
Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 <https://github.com/owncloud/core/issues/3>
/var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621):
Doctrine\DBAL\Connection->getDatabasePlatform()
#4 <https://github.com/owncloud/core/pull/4>
/var/www/owncloud-org/lib/private/DB/Connection.php(141):
Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 <https://github.com/owncloud/core/issues/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 <https://github.com/owncloud/core/pull/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 <https://github.com/owncloud/core/pull/7>
/var/www/owncloud-org/lib/private/Server.php(410):
OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 <https://github.com/owncloud/core/pull/8>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#9 <https://github.com/owncloud/core/pull/9>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('DatabaseConnect...')
#10 <https://github.com/owncloud/core/pull/10>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#11 <https://github.com/owncloud/core/pull/11>
/var/www/owncloud-org/lib/private/Server.php(969):
OC\ServerContainer->query('DatabaseConnect...')
#12 <https://github.com/owncloud/core/pull/12>
/var/www/owncloud-org/lib/private/Server.php(215):
OC\Server->getDatabaseConnection()
#13 <https://github.com/owncloud/core/pull/13>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#14 <https://github.com/owncloud/core/pull/14>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('OC\Authenticati...')
#15 <https://github.com/owncloud/core/pull/15>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#16 <https://github.com/owncloud/core/pull/16>
/var/www/owncloud-org/lib/private/Server.php(219):
OC\ServerContainer->query('OC\Authenticati...')
#17 <https://github.com/owncloud/core/pull/17>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#18 <https://github.com/owncloud/core/pull/18>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('OC\Authenticati...')
#19 <https://github.com/owncloud/core/pull/19>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#20 <https://github.com/owncloud/core/pull/20>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(150):
OC\ServerContainer->query('OC\Authenticati...')
#21 <https://github.com/owncloud/core/pull/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 <https://github.com/owncloud/core/pull/22>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('OC\Authenticati...')
#23 <https://github.com/owncloud/core/pull/23>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#24 <https://github.com/owncloud/core/pull/24>
/var/www/owncloud-org/lib/private/Server.php(234):
OC\ServerContainer->query('OC\Authenticati...')
#25 <https://github.com/owncloud/core/pull/25>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#26 <https://github.com/owncloud/core/pull/26>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('UserSession')
#27 <https://github.com/owncloud/core/pull/27>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('UserSession')
#28 <https://github.com/owncloud/core/pull/28>
/var/www/owncloud-org/lib/private/Server.php(846):
OC\ServerContainer->query('UserSession')
#29 <https://github.com/owncloud/core/pull/29>
/var/www/owncloud-org/lib/private/Server.php(454):
OC\Server->getUserSession()
#30 <https://github.com/owncloud/core/pull/30>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#31 <https://github.com/owncloud/core/pull/31>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('AppManager')
#32 <https://github.com/owncloud/core/pull/32>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#33 <https://github.com/owncloud/core/pull/33>
/var/www/owncloud-org/lib/private/Server.php(1146):
OC\ServerContainer->query('AppManager')
#34 <https://github.com/owncloud/core/pull/34>
/var/www/owncloud-org/lib/private/legacy/app.php(284):
OC\Server->getAppManager()
#35 <https://github.com/owncloud/core/pull/35>
/var/www/owncloud-org/lib/private/legacy/app.php(105):
OC_App::getEnabledApps()
#36 <https://github.com/owncloud/core/pull/36>
/var/www/owncloud-org/lib/base.php(573): OC_App::loadApps(Array)
#37 <https://github.com/owncloud/core/pull/37>
/var/www/owncloud-org/lib/base.php(967): OC::init()
#38 <https://github.com/owncloud/core/pull/38>
/var/www/owncloud-org/console.php(50): require_once('/var/www/ownclo...')
#39 <https://github.com/owncloud/core/pull/39>
/var/www/owncloud-org/occ(11): require_once('/var/www/ownclo...')

*The content of config/config.php:*
<?php
$CONFIG = array (
'instanceid' => '50f2b69bdd312',
'passwordsalt' => '78c33d331f4ddbcb763a26dd5263a3',
'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' =>
'94112ef32c6fd2ab1c9fc0037114678a12e81c3e28628b0e553a34955492a12eb3110d87cf3838499afcd4f70f46af9e',
'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 <https://github.com/owncloud/core/pull/1>
/var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389):
Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 <https://github.com/owncloud/core/issues/2>
/var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328):
Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 <https://github.com/owncloud/core/issues/3>
/var/www/owncloud-org/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(621):
Doctrine\DBAL\Connection->getDatabasePlatform()
#4 <https://github.com/owncloud/core/pull/4>
/var/www/owncloud-org/lib/private/DB/Connection.php(141):
Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 <https://github.com/owncloud/core/issues/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 <https://github.com/owncloud/core/pull/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 <https://github.com/owncloud/core/pull/7>
/var/www/owncloud-org/lib/private/Server.php(410):
OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 <https://github.com/owncloud/core/pull/8>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#9 <https://github.com/owncloud/core/pull/9>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('DatabaseConnect...')
#10 <https://github.com/owncloud/core/pull/10>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#11 <https://github.com/owncloud/core/pull/11>
/var/www/owncloud-org/lib/private/Server.php(969):
OC\ServerContainer->query('DatabaseConnect...')
#12 <https://github.com/owncloud/core/pull/12>
/var/www/owncloud-org/lib/private/Server.php(215):
OC\Server->getDatabaseConnection()
#13 <https://github.com/owncloud/core/pull/13>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#14 <https://github.com/owncloud/core/pull/14>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('OC\Authenticati...')
#15 <https://github.com/owncloud/core/pull/15>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#16 <https://github.com/owncloud/core/pull/16>
/var/www/owncloud-org/lib/private/Server.php(219):
OC\ServerContainer->query('OC\Authenticati...')
#17 <https://github.com/owncloud/core/pull/17>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#18 <https://github.com/owncloud/core/pull/18>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('OC\Authenticati...')
#19 <https://github.com/owncloud/core/pull/19>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#20 <https://github.com/owncloud/core/pull/20>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(150):
OC\ServerContainer->query('OC\Authenticati...')
#21 <https://github.com/owncloud/core/pull/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 <https://github.com/owncloud/core/pull/22>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('OC\Authenticati...')
#23 <https://github.com/owncloud/core/pull/23>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('OC\Authenticati...')
#24 <https://github.com/owncloud/core/pull/24>
/var/www/owncloud-org/lib/private/Server.php(234):
OC\ServerContainer->query('OC\Authenticati...')
#25 <https://github.com/owncloud/core/pull/25>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#26 <https://github.com/owncloud/core/pull/26>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('UserSession')
#27 <https://github.com/owncloud/core/pull/27>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('UserSession')
#28 <https://github.com/owncloud/core/pull/28>
/var/www/owncloud-org/lib/private/Server.php(846):
OC\ServerContainer->query('UserSession')
#29 <https://github.com/owncloud/core/pull/29>
/var/www/owncloud-org/lib/private/Server.php(454):
OC\Server->getUserSession()
#30 <https://github.com/owncloud/core/pull/30>
/var/www/owncloud-org/3rdparty/pimple/pimple/src/Pimple/Container.php(113):
OC\Server->OC{closure}(Object(OC\Server))
#31 <https://github.com/owncloud/core/pull/31>
/var/www/owncloud-org/lib/private/AppFramework/Utility/SimpleContainer.php(102):
Pimple\Container->offsetGet('AppManager')
#32 <https://github.com/owncloud/core/pull/32>
/var/www/owncloud-org/lib/private/ServerContainer.php(87):
OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#33 <https://github.com/owncloud/core/pull/33>
/var/www/owncloud-org/lib/private/Server.php(1146):
OC\ServerContainer->query('AppManager')
#34 <https://github.com/owncloud/core/pull/34>
/var/www/owncloud-org/lib/private/legacy/app.php(284):
OC\Server->getAppManager()
#35 <https://github.com/owncloud/core/pull/35>
/var/www/owncloud-org/lib/private/legacy/app.php(105):
OC_App::getEnabledApps()
#36 <https://github.com/owncloud/core/pull/36>
/var/www/owncloud-org/lib/base.php(573): OC_App::loadApps(Array)
#37 <https://github.com/owncloud/core/pull/37>
/var/www/owncloud-org/lib/base.php(967): OC::init()
#38 <https://github.com/owncloud/core/pull/38>
/var/www/owncloud-org/console.php(50): require_once('/var/www/ownclo...')
#39 <https://github.com/owncloud/core/pull/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|

_______________________________________________
Devel mailing list
[hidden email]
http://mailman.owncloud.org/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

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

Chris-3
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

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

Christian Rost
In reply to this post by Anton Blau
Hi Anton,

seems like

On 09/15/2016 09:51 PM, Anton Blau wrote:

> 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:

seems like the password in your config.php is wrong / missing

> 'dbname' => 'owncloud',
> 'dbhost' => '127.0.0.1',
> 'dbuser' => 'root',
> 'dbpassword' => '',

Did you remove the pw for the mail here or is there no password shown in
the config.php?

cheers,
  chris


_______________________________________________
Devel mailing list
[hidden email]
http://mailman.owncloud.org/mailman/listinfo/devel

signature.asc (220 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Anton Blau
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;

4. Restore MySQL Dump (mysql -u username -p database_name < dump.sql)
5. Backup /var/www/owncloud/config + /var/www/owncloud/data
6. Delete all owncloud* Packages
7. Reinstall owncloud
8. 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


_______________________________________________
Devel mailing list
[hidden email]
http://mailman.owncloud.org/mailman/listinfo/devel