[SOLVED] Delete nextcloud.oc_accounts

Hello,
I’m an idiot
I think I delete nextcloud.oc_accounts database when I want to learn sql command, I suppose.
now I’ve an error message:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_accounts' doesn't exist"

When i’m using

mysqlcheck -u admin_mysql -p nextcloud

I have a lot of things but not nextcloud.oc_accounts OK
I have an issue to reconstruct the database ?
My nextcloud server work fine but I can’t have any access to parameters with users and admin.

Thanks for yours responses

PS: sorry for my poor english.

Hi JeromeSi,

Always do backups of your database / file structure before you are working on it, as you could have used the backup to restore it.

Creating the missing table should not be a problem but it would not have any content, such as the admin, or any other user you may already have created.

Was this a fresh install or were you already using it productive, as in did you already have any data stored on your Nextcloud?

If this was a fresh install, I would suggest to reinstall Nextcloud - If this was not a fresh install, you could just create the missing table and use OCC commands to add a new user (if you have SSH access)

Here is a link to the official documentation about using the OCC command:

https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html?#user-commands

Thanks, you’re right.
I’m going to understand database manipulations and found the structure (?) of nextcloud.oc_accounts (if you have got a link…actually i’m searching on developper documents)
I’ve got only 7 users, that’s my personnal nextcloud. It’s not a problem to create it myself.
EDIT : i’m going to read your link

Problem solved.
In fact, it’s easy.
I’m create the table in the database and nextcloud add all the data.
CREATE TABLE oc_accounts (
uid VARCHAR(64) NOT NULL,
data LONGTEXT NOT NULL,
PRIMARY KEY (uid)
)
ENGINE=INNODB;

Hi JeromeSi, may i know how you create the table in the database and nextcloud add all the data? My nextcloud work fine too and I don’t have any access to parameters with users instead of admin.

I’ve got this error message:

{“reqId”:“q4e1UT4gJgK1QOh5KhQp”,“level”:3,“time”:“2020-11-02T08:43:53+00:00”,“remoteAddr”:“192.168.0.1”,“user”:“admin”,“app”:“index”,“method”:“GET”,“url”:"/settings/user",“message”:{“Exception”:“Doctrine\DBAL\Exception\TableNotFoundException”,“Message”:“An exception occurred while executing ‘SELECT data FROM oc_accounts WHERE uid = ?’ with params [“admin”]:\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextclouddb.oc_accounts’ doesn’t exist”,“Code”:0,“Trace”:[{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php",“line”:170,“function”:“convertException”,“class”:“Doctrine\DBAL\Driver\AbstractMySQLDriver”,“type”:"->",“args”:[“An exception occurred while executing ‘SELECT data FROM oc_accounts WHERE uid = ?’ with params [“admin”]:\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextclouddb.oc_accounts’ doesn’t exist”,{“errorInfo”:[“42S02”,1146,“Table ‘nextclouddb.oc_accounts’ doesn’t exist”],“class”:“Doctrine\DBAL\Driver\PDOException”}]},{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php",“line”:150,“function”:“wrapException”,“class”:“Doctrine\DBAL\DBALException”,“type”:"::",“args”:[{“class”:“Doctrine\DBAL\Driver\PDOMySql\Driver”},{“errorInfo”:[“42S02”,1146,“Table ‘nextclouddb.oc_accounts’ doesn’t exist”],“class”:“Doctrine\DBAL\Driver\PDOException”},“An exception occurred while executing ‘SELECT data FROM oc_accounts WHERE uid = ?’ with params [“admin”]:\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextclouddb.oc_accounts’ doesn’t exist”]},{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php",“line”:914,“function”:“driverExceptionDuringQuery”,“class”:“Doctrine\DBAL\DBALException”,“type”:"::",“args”:[{“class”:“Doctrine\DBAL\Driver\PDOMySql\Driver”},{“errorInfo”:[“42S02”,1146,“Table ‘nextclouddb.oc_accounts’ doesn’t exist”],“class”:“Doctrine\DBAL\Driver\PDOException”},“SELECT data FROM oc_accounts WHERE uid = ?”,{“1”:“admin”}]},{“file”:"/var/www/html/lib/private/DB/Connection.php",“line”:194,“function”:“executeQuery”,“class”:“Doctrine\DBAL\Connection”,“type”:"->",“args”:[“SELECT data FROM oc_accounts WHERE uid = ?”,[“admin”],[2],null]},{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php",“line”:206,“function”:“executeQuery”,“class”:“OC\DB\Connection”,“type”:"->",“args”:[“SELECT data FROM oc_accounts WHERE uid = :uid”,{“uid”:“admin”},[]]},{“file”:"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",“line”:217,“function”:“execute”,“class”:“Doctrine\DBAL\Query\QueryBuilder”,“type”:"->",“args”:[]},{“file”:"/var/www/html/lib/private/Accounts/AccountManager.php",“line”:141,“function”:“execute”,“class”:“OC\DB\QueryBuilder\QueryBuilder”,“type”:"->",“args”:[]},{“file”:"/var/www/html/apps/settings/lib/Settings/Personal/PersonalInfo.php",“line”:106,“function”:“getUser”,“class”:“OC\Accounts\AccountManager”,“type”:"->",“args”:[{“class”:“OC\User\User”}]},{“file”:"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",“line”:141,“function”:“getForm”,“class”:“OCA\Settings\Settings\Personal\PersonalInfo”,“type”:"->",“args”:[]},{“file”:"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php",“line”:77,“function”:“formatSettings”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[{“10”:[{“class”:“OCA\Settings\Settings\Personal\PersonalInfo”}],“1000”:[{“class”:“OCA\Settings\Settings\Personal\ServerDevNotice”}]}]},{“file”:"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",“line”:152,“function”:“getSettings”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal-info”]},{“file”:"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php",“line”:68,“function”:“getIndexResponse”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal”,“personal-info”]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“index”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal-info”]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Settings\Controller\PersonalSettingsController”},“index”]},{“file”:"/var/www/html/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Settings\Controller\PersonalSettingsController”},“index”]},{“file”:"/var/www/html/lib/private/Route/Router.php",“line”:308,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::",“args”:[“OCA\Settings\Controller\PersonalSettingsController”,“index”,{“class”:“OC\AppFramework\DependencyInjection\DIContainer”},{“section”:“personal-info”,“action”:null,"_route":“settings.PersonalSettings.index”}]},{“file”:"/var/www/html/lib/base.php",“line”:1009,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->",“args”:["/settings/user"]},{“file”:"/var/www/html/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php",“Line”:42,“Previous”:{“Exception”:“Doctrine\DBAL\Driver\PDOException”,“Message”:“SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextclouddb.oc_accounts’ doesn’t exist”,“Code”:“42S02”,“Trace”:[{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php",“line”:906,“function”:“execute”,“class”:“Doctrine\DBAL\Driver\PDOStatement”,“type”:"->",“args”:[]},{“file”:"/var/www/html/lib/private/DB/Connection.php",“line”:194,“function”:“executeQuery”,“class”:“Doctrine\DBAL\Connection”,“type”:"->",“args”:[“SELECT data FROM oc_accounts WHERE uid = ?”,[“admin”],[2],null]},{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php",“line”:206,“function”:“executeQuery”,“class”:“OC\DB\Connection”,“type”:"->",“args”:[“SELECT data FROM oc_accounts WHERE uid = :uid”,{“uid”:“admin”},[]]},{“file”:"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",“line”:217,“function”:“execute”,“class”:“Doctrine\DBAL\Query\QueryBuilder”,“type”:"->",“args”:[]},{“file”:"/var/www/html/lib/private/Accounts/AccountManager.php",“line”:141,“function”:“execute”,“class”:“OC\DB\QueryBuilder\QueryBuilder”,“type”:"->",“args”:[]},{“file”:"/var/www/html/apps/settings/lib/Settings/Personal/PersonalInfo.php",“line”:106,“function”:“getUser”,“class”:“OC\Accounts\AccountManager”,“type”:"->",“args”:[{“class”:“OC\User\User”}]},{“file”:"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",“line”:141,“function”:“getForm”,“class”:“OCA\Settings\Settings\Personal\PersonalInfo”,“type”:"->",“args”:[]},{“file”:"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php",“line”:77,“function”:“formatSettings”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[{“10”:[{“class”:“OCA\Settings\Settings\Personal\PersonalInfo”}],“1000”:[{“class”:“OCA\Settings\Settings\Personal\ServerDevNotice”}]}]},{“file”:"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",“line”:152,“function”:“getSettings”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal-info”]},{“file”:"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php",“line”:68,“function”:“getIndexResponse”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal”,“personal-info”]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“index”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal-info”]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Settings\Controller\PersonalSettingsController”},“index”]},{“file”:"/var/www/html/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Settings\Controller\PersonalSettingsController”},“index”]},{“file”:"/var/www/html/lib/private/Route/Router.php",“line”:308,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::",“args”:[“OCA\Settings\Controller\PersonalSettingsController”,“index”,{“class”:“OC\AppFramework\DependencyInjection\DIContainer”},{“section”:“personal-info”,“action”:null,"_route":“settings.PersonalSettings.index”}]},{“file”:"/var/www/html/lib/base.php",“line”:1009,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->",“args”:["/settings/user"]},{“file”:"/var/www/html/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php",“Line”:129,“Previous”:{“Exception”:“PDOException”,“Message”:“SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextclouddb.oc_accounts’ doesn’t exist”,“Code”:“42S02”,“Trace”:[{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php",“line”:127,“function”:“execute”,“class”:“PDOStatement”,“type”:"->",“args”:[null]},{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php",“line”:906,“function”:“execute”,“class”:“Doctrine\DBAL\Driver\PDOStatement”,“type”:"->",“args”:[]},{“file”:"/var/www/html/lib/private/DB/Connection.php",“line”:194,“function”:“executeQuery”,“class”:“Doctrine\DBAL\Connection”,“type”:"->",“args”:[“SELECT data FROM oc_accounts WHERE uid = ?”,[“admin”],[2],null]},{“file”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php",“line”:206,“function”:“executeQuery”,“class”:“OC\DB\Connection”,“type”:"->",“args”:[“SELECT data FROM oc_accounts WHERE uid = :uid”,{“uid”:“admin”},[]]},{“file”:"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",“line”:217,“function”:“execute”,“class”:“Doctrine\DBAL\Query\QueryBuilder”,“type”:"->",“args”:[]},{“file”:"/var/www/html/lib/private/Accounts/AccountManager.php",“line”:141,“function”:“execute”,“class”:“OC\DB\QueryBuilder\QueryBuilder”,“type”:"->",“args”:[]},{“file”:"/var/www/html/apps/settings/lib/Settings/Personal/PersonalInfo.php",“line”:106,“function”:“getUser”,“class”:“OC\Accounts\AccountManager”,“type”:"->",“args”:[{“class”:“OC\User\User”}]},{“file”:"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",“line”:141,“function”:“getForm”,“class”:“OCA\Settings\Settings\Personal\PersonalInfo”,“type”:"->",“args”:[]},{“file”:"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php",“line”:77,“function”:“formatSettings”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[{“10”:[{“class”:“OCA\Settings\Settings\Personal\PersonalInfo”}],“1000”:[{“class”:“OCA\Settings\Settings\Personal\ServerDevNotice”}]}]},{“file”:"/var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php",“line”:152,“function”:“getSettings”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal-info”]},{“file”:"/var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php",“line”:68,“function”:“getIndexResponse”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal”,“personal-info”]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“index”,“class”:“OCA\Settings\Controller\PersonalSettingsController”,“type”:"->",“args”:[“personal-info”]},{“file”:"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Settings\Controller\PersonalSettingsController”},“index”]},{“file”:"/var/www/html/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Settings\Controller\PersonalSettingsController”},“index”]},{“file”:"/var/www/html/lib/private/Route/Router.php",“line”:308,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::",“args”:[“OCA\Settings\Controller\PersonalSettingsController”,“index”,{“class”:“OC\AppFramework\DependencyInjection\DIContainer”},{“section”:“personal-info”,“action”:null,"_route":“settings.PersonalSettings.index”}]},{“file”:"/var/www/html/lib/base.php",“line”:1009,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->",“args”:["/settings/user"]},{“file”:"/var/www/html/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php",“Line”:127}},“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36”,“version”:“20.0.1.1”}

I’m sorry because this is my first time ever to ask question on nextcloud forum.