Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000]

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 18.0.2): 19.0.3.1
Operating system and version (eg, Ubuntu 20.04): rancher 4.14.138
Apache or nginx version (eg, Apache 2.4.25): 2.4.38
PHP version (eg, 7.1): 7.4.10
Database : Local sqlite3

The issue you are facing:
I think it’s related to a problem of diskpace on my docker.
I solved the space problem by expanding the partition, but the problem persists.
Unable to access to the admin page / nextcloud not working.

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.

More details can be found in the server log.

Logs indicate a database problem.
Corrupted data…
What can I do ?

Many thanks!

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Try to access web-interface

The output of your Nextcloud log in Admin > Logging:

No access to the admin page.

The output of your config.php file in /var/www/html/config

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' =>
  array (
    0 => 'x.x.x.x:xxxx',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'sqlite3',
  'version' => '19.0.3.1',
  'overwrite.cli.url' => 'http://x.x.x.x:xxxx',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

 unable to open database file","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php","line":889,"function":"connect","class":"OC\\\\DB\\\\Connection","type":"->","args":[]},{"file":"/var/www/html/lib/private/DB/Connection.php","line":194,"function":"executeQuery","class":"Doctrine\\\\DBAL\\\\Connection","type":"->","args":["SELECT * FROM \\"oc_appconfig\\"",[],[],null]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php","line":200,"function":"executeQuery","class":"OC\\\\DB\\\\Connection","type":"->","args":["SELECT * FROM \\"oc_appconfig\\"",[],[]]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":216,"function":"execute","class":"Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":331,"function":"execute","class":"OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":109,"function":"loadConfigValues","class":"OC\\\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppConfig.php","line":287,"function":"getApps","class":"OC\\\\AppConfig","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":883,"function":"getValues","class":"OC\\\\AppConfig","type":"->","args":[false,"installed_version"]},{"file":"/var/www/html/lib/private/Server.php","line":665,"function":"getAppVersions","class":"OC_App","type":"::","args":[]},{"file":"/var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/ServerContainer.php","line":124,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\Memcache\\\\Factory"]},{"file":"/var/www/html/lib/private/Server.php","line":1704,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\Memcache\\\\Factory"]},{"file":"/var/www/html/lib/private/Server.php","line":856,"function":"getMemCacheFactory","class":"OC\\\\Server","type":"->","args":[]},{"file":"/var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/ServerContainer.php","line":124,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\App\\\\AppManager"]},{"file":"/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":163,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\App\\\\AppManager"]},{"file":"/var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php","line":114,"function":"OC\\\\AppFramework\\\\Utility\\\\{closure}","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/ServerContainer.php","line":124,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OCP\\\\App\\\\IAppManager"]},{"file":"/var/www/html/lib/private/Server.php","line":1894,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OCP\\\\App\\\\IAppManager"]},{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":347,"function":"getAppManager","class":"OC\\\\Server","type":"->","args":[]},{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":114,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":648,"function":"loadApps","class":"OC_App","type":"::","args":[["session"]]},{"file":"/var/www/html/lib/base.php","line":1095,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/status.php","line":37,"args":["/var/www/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/DB/Connection.php","Line":67,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows) mirall/3.0.1stable-Win64 (build 20200828) (Nextcloud)","version":"19.0.3.1"}
x.x.x.x- admin [20/Sep/2020:13:46:23 +0000] "GET /status.php HTTP/1.1" 500 425 "-" "Mozilla/5.0 (Windows) mirall/3.0.1stable-Win64 (build 20200828) (Nextcloud)"

Check if the SQLite database file exists in /var/www/html/data and if the access rights are correctly set:

ls -al /var/www/html/data./nextcloud.db

Hi
Thank you for your answer
The bdd file is indeed there (under the name owncloud.db)
I can read the data correctly via DBBrowser and nothing is corrupt according to the soft.

I think this is the opportunity to switch to a Mysql database. It will be much easier!
I just have to look at how to migrate data from SQLLite to MySQL…

Thanks.

1 Like