Nextcloud version: 18.0.0 (was also not working with 17.0.2)
Operating system and version: shared hoster, probably linux
Apache or nginx version: Apache
PHP version: 7.3
The issue you are facing:
Dear community,
I cannot access the OCC commands via SSH. After around 60 seconds a timeout issue appears: “SQLSTATE[HY000] [2002] Connection timed out in” (see logs below)
I have debugged the Instance and I cannot see any missing or wrong information for the database. Tried it with “localhost” and “127.0.0.1”.
My nextcloud instance is running fine in the browser and in the app. Synchronisation via davx is also working as expected. I just cannot run any occ command.
I am running nextcloud in a shared hoster environment.
Thanks a lot for your help!
Is this the first time you’ve seen this error? Y
Steps to replicate it:
- Start SSH
- run in nextcloud dir “php occ -v” e.g.
- Get timeout error
The output of your Nextcloud log in Admin > Logging:
no log available
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
<?php
$CONFIG = array (
'instanceid' => 'xxx',
'passwordsalt' => 'xxx',
'secret' => 'xxx',
'trusted_domains' =>
array (
0 => 'xxx',
),
'datadirectory' => 'xxx/data',
'overwrite.cli.url' => 'xxx',
'dbtype' => 'mysql',
'version' => '18.0.0.10',
'dbname' => xxx',
'dbhost' => '127.0.0.1',
'dbport' => '',
'dbtableprefix' => 'xxx',
'dbuser' => 'xxx',
'dbpassword' => 'xxx',
'installed' => true,
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'mail_from_address' => 'nextcloud',
'mail_smtpmode' => 'smtp',
'mail_smtpauthtype' => 'LOGIN',
'mail_domain' => 'xxx',
'mail_smtpsecure' => 'ssl',
'mail_smtpauth' => 1,
'mail_smtphost' => 'xxx',
'mail_smtpport' => '465',
'mail_smtpname' => 'xxx',
'mail_smtppassword' => 'xxx',
'updater.release.channel' => 'beta',
'updater.secret' => 'xxx',
'enable_previews' => true,
'preview_max_y' => 500,
'preview_max_x' => 500,
);
The output of your Apache/nginx/system log in /var/log/____
:
php occ -v
Error in GnuTLS initialization: Failed to acquire random data.
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection timed out in xxx/lib/private/DB/Connection.php:68
Stack trace:
#0 xxx/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(420): OC\DB\Connection->connect()
#1 xxx/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(380): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 xxx/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(324): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 xxx/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(683): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 xxx/lib/private/DB/Connection.php(155): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 xxx/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(195): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 xxx/lib/private/DB/ConnectionFactory.php(159): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 xxx/lib/private/Server.php(748): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#9 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OCP\\IDBConnecti...')
#10 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OCP\\IDBConnecti...')
#11 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#12 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('DatabaseConnect...')
#13 xxx/lib/private/Server.php(1663): OC\ServerContainer->query('DatabaseConnect...')
#14 xxx/lib/private/Server.php(421): OC\Server->getDatabaseConnection()
#15 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#16 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\Authenticati...')
#17 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(70): OC\ServerContainer->query('OC\\Authenticati...', true)
#18 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(100): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#19 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(115): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#20 xxx/lib/private/ServerContainer.php(150): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...', true)
#21 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(70): OC\ServerContainer->query('OC\\Authenticati...', true)
#22 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(100): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#23 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(115): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\Authenticati...')
#24 xxx/lib/private/ServerContainer.php(150): OC\AppFramework\Utility\SimpleContainer->query('OC\\Authenticati...', true)
#25 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OC\\Authenticati...')
#26 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#27 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\Authenticati...')
#28 xxx/lib/private/Server.php(433): OC\ServerContainer->query('OC\\Authenticati...')
#29 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#30 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\User\\Session')
#31 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OC\\User\\Session')
#32 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#33 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('UserSession')
#34 xxx/lib/private/Server.php(1539): OC\ServerContainer->query('UserSession')
#35 xxx/lib/private/Server.php(801): OC\Server->getUserSession()
#36 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC\{closure}(Object(OC\Server))
#37 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('OC\\App\\AppManag...')
#38 xxx/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\ServerContainer->query('OC\\App\\AppManag...')
#39 xxx/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#40 xxx/lib/private/ServerContainer.php(125): Pimple\Container->offsetGet('AppManager')
#41 xxx/lib/private/Server.php(1834): OC\ServerContainer->query('AppManager')
#42 xxx/lib/private/legacy/app.php(347): OC\Server->getAppManager()
#43 xxx/lib/private/legacy/app.php(114): OC_App::getEnabledApps()
#44 xxx/lib/base.php(645): OC_App::loadApps(Array)
#45 xxx/lib/base.php(1089): OC::init()
#46 xxx/console.php(48): require_once('/is/htdocs/wp12...')
#47 xxx/occ(11): require_once('/is/htdocs/wp12...')
#48 {main}