I am running the latest version of Nextcloud on Ubuntu 20. I do a restore of the DB and data directory to my new installation. I run the maintenance:data-fingerprint command, and I receive the following:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /var/www/html/nextcloud/lib/private/DB/Connection.php:67
How do I resolve this?
Have you tried to install the required PHP database driver module which fits to your database, e.g. php-mysql if you use a MySQL/MariaDB database.
It looks like I did. Here is the process that I followed: https://www.techrepublic.com/article/how-to-install-nextcloud-20-on-ubuntu-server-20-04/
Can anyone please assist me?
I did a apt-install php-mysql, and I still get this error message:
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /var/www/nextcloud/lib/private/DB/Connection.php:67
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(889): OC\DB\Connection->connect()
#1 /var/www/nextcloud/lib/private/DB/Connection.php(194): Doctrine\DBAL\Connection->executeQuery()
…
Hi droidus,
Have you you done this command line before ?
mysql -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
when you have recreate database on your nex installation with this command ?
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
read more about : Restoring backup — Nextcloud latest Administration Manual latest documentation
Please check your config file under ../nextcloud/config/config.php
. There are at least 3 points to check:
-
'dbtype' => 'mysql',
per defalt it is “SQLite3” that is not your case according to the totorial. - Please check if other DB parameters are correct, e.g.
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbuser' => 'nextcloud',
'dbpassword' => 'asdasdasdasd',
- Ensure that following parameters are copied from the old instance.
'instanceid' => 'yxcyxcyxc',
'passwordsalt' => 'asdfasdfasdf',
'secret' => '123123123123123',
Read more about: Configuration Parameters — Nextcloud latest Administration Manual latest documentation
Ok, I did follow that link to drop/create the db, then restore it.
As for the credentials, I did not see those parameters set in my other instance config file, but I set them in my new one anyways. I attempted to run the command again, and I think I am getting closer, but now am seeing a bunch of these kinds of errors:
Next Doctrine\DBAL\Driver\PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:90
Next Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing 'SELECT * FROM oc_appconfig
':
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:42
In this topic: Error: Table 'nextcloud.oc_appconfig' doesn't exist
one of the solution is : sudo chown -R www-data:www-data /var/www/nextcloud
Have you done this command when you have migrated your data?
I ran that command, then attempted to generate a new fingerprint with this: sudo -u www-data php /var/www/nextcloud/occ maintenance:data-fingerprint.
I get several errors still:
An unhandled exception has been thrown:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:88
Next Doctrine\DBAL\Driver\PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:90
Next Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing 'SELECT * FROM oc_appconfig
':
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:42
@droidus maybe by trying this it can solve your problem :
in your nextcloud server directory : sudo -u www-data php occ maintenance:repair
I still get these errors:
Next Doctrine\DBAL\Driver\PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doct
rine/DBAL/Driver/PDOConnection.php:90
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(908): Doctrine\DBAL\Driver\PDOConnection->query()
#1 /var/www/nextcloud/lib/private/DB/Connection.php(194): Doctrine\DBAL\Connection->executeQuery()
…
Next Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing ‘SELECT * FROM oc_appconfig
’:
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:42
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(169): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(145): Doctrine\DBAL\DBALException::wrapException()
…
@droidus
Have you use this command during during the restoration of your database ??
mysql -u [username] -p [db_name] < nextcloud.bak
Yes, I have.
Any more ideas?
I am not, as the data directories are in different locations.