Wrong suffix database username 'Failed to connect to the database'

I’m having issues trying to connect to my database (mariadb). As you can see in the error below Nextcloud tries to connect with the user ‘admin.berkelland’@‘nextcloud.backend’. This suffix is incorrect and should be ‘admin.berkelland’@‘mysql’.

I’m using version 18.0.10.2.

{
“reqId”: “5VCRVyOFCbC8VbztbU5i”,
“level”: 3,
“time”: “2020-12-24T20:41:29+00:00”,
“remoteAddr”: “REMOVED”,
“user”: “–”,
“app”: “core”,
“method”: “GET”,
“url”: “/”,
“message”: {
“Exception”: “Doctrine\DBAL\DBALException”,
“Message”: “Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘admin.berkelland’@‘nextcloud.backend’ (using password: YES)”,
“Code”: 0,
“Trace”: [
{
“file”: “/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php”,
“line”: 1449,
“function”: “connect”,
“class”: “OC\DB\Connection”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php”,
“line”: 892,
“function”: “getWrappedConnection”,
“class”: “Doctrine\DBAL\Connection”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/DB/Connection.php”,
“line”: 202,
“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”: 206,
“function”: “executeQuery”,
“class”: “OC\DB\Connection”,
“type”: “->”,
“args”: [
“SELECT * FROM oc_appconfig”,
,

]
},
{
“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/AppConfig.php”,
“line”: 345,
“function”: “execute”,
“class”: “OC\DB\QueryBuilder\QueryBuilder”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/AppConfig.php”,
“line”: 110,
“function”: “loadConfigValues”,
“class”: “OC\AppConfig”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/AppConfig.php”,
“line”: 301,
“function”: “getApps”,
“class”: “OC\AppConfig”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/legacy/OC_App.php”,
“line”: 949,
“function”: “getValues”,
“class”: “OC\AppConfig”,
“type”: “->”,
“args”: [
false,
“installed_version”
]
},
{
“file”: “/var/www/html/lib/private/TemplateLayout.php”,
“line”: 185,
“function”: “getAppVersions”,
“class”: “OC_App”,
“type”: “::”,
“args”:
},
{
“file”: “/var/www/html/lib/private/legacy/OC_Template.php”,
“line”: 183,
“function”: “__construct”,
“class”: “OC\TemplateLayout”,
“type”: “->”,
“args”: [
“error”,
“”
]
},
{
“file”: “/var/www/html/lib/private/Template/Base.php”,
“line”: 132,
“function”: “fetchPage”,
“class”: “OC_Template”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/lib/private/legacy/OC_Template.php”,
“line”: 332,
“function”: “printPage”,
“class”: “OC\Template\Base”,
“type”: “->”,
“args”:
},
{
“file”: “/var/www/html/index.php”,
“line”: 63,
“function”: “printExceptionErrorPage”,
“class”: “OC_Template”,
“type”: “::”,
“args”: [
{
class”: “Doctrine\DBAL\DBALException”
},
500
]
}
],
“File”: “/var/www/html/lib/private/DB/Connection.php”,
“Line”: 72,
“CustomMessage”: “–”
},
“userAgent”: “Mozilla/5.0 (compatible; PRTG Network Monitor (www.paessler.com); Windows)”,
“version”: “18.0.10.2”
}

Part of config.php that contains mysql connection information:

‘dbname’ => ‘nextcloud_db’,
‘dbhost’ => ‘mysql’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘admin.berkelland’,
‘dbpassword’ => ‘’,

How can I get the username right?

Hello @FerronN ,

welcome to the community of Nextcloud.

What happened before you got this error?
Any changes in your environment?

What is logged in your nextcloud.log file?

Hello @rakekniven,

The first blockquote comes from the nextcloud.log file.
I moved my installation to a different environment and updates from nextcloud 16 to 18 I think.
With this new environment came another mysql server. I created the same username + password on this server as on the previous old server. I only replaced the servername with the new value.

Trought the CLI I can connect with this command: ’ mysql -h localhost -u admin.berkelland -p nextcloud_db’ from within the mariadb docker container.

The way I created the user was wrong… (with domain). I created it now likes this and it work ''CREATE USER ‘admin.berkelland’ IDENTIFIED BY ‘’;

1 Like