Problems with creating first admin

Hello,

Yesterday I installed successfully NextCloud on my Synology ds418 with the following manual: https://mariushosting.com/how-to-install-nextcloud-on-your-synology-nas/.

But after I tried to create the first admin account, I got the following error:
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘oc_admin’@‘localhost’ (using password: YES)

My knowledge about databases is very bad and after a lot of Googling I couldn’t find an answer. I get a lot of errors about wrong SQL syntaxes: {“reqId”:“QrPSYs4wO8TEQ5OJ6GMe”,“level”:3,“time”:“2020-01-06T17:47:40+00:00”,“remoteAddr”:"…",“user”:"–",“app”:“mysql.setup”,“method”:“POST”,“url”:"/index.php",“message”:{“Exception”:“Doctrine\DBAL\Exception\SyntaxErrorException”,“Message”:“An exception occurred while executing ‘CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’’:\n\nSQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”,“Code”:0,“Trace”:[{“file”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php",“line”:169,“function”:“convertException”,“class”:“Doctrine\DBAL\Driver\AbstractMySQLDriver”,“type”:"->",“args”:[“An exception occurred while executing ‘CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’’:\n\nSQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”,{“errorInfo”:[“42000”,1064,“You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”],“class”:“Doctrine\DBAL\Driver\PDOException”}]},{“file”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php",“line”:145,“function”:“wrapException”,“class”:“Doctrine\DBAL\DBALException”,“type”:"::",“args”:[{“class”:“Doctrine\DBAL\Driver\PDOMySql\Driver”},{“errorInfo”:[“42000”,1064,“You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”],“class”:“Doctrine\DBAL\Driver\PDOException”},“An exception occurred while executing ‘CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’’:\n\nSQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”]},{“file”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php",“line”:1063,“function”:“driverExceptionDuringQuery”,“class”:“Doctrine\DBAL\DBALException”,“type”:"::",“args”:[{“class”:“Doctrine\DBAL\Driver\PDOMySql\Driver”},{“errorInfo”:[“42000”,1064,“You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”],“class”:“Doctrine\DBAL\Driver\PDOException”},“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”,[]]},{“file”:"/volume1/web/nextcloud/lib/private/DB/Connection.php",“line”:216,“function”:“executeUpdate”,“class”:“Doctrine\DBAL\Connection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”,[],[]]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:104,“function”:“executeUpdate”,“class”:“OC\DB\Connection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:149,“function”:“createDBUser”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[{“class”:“OC\DB\Connection”}]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:50,“function”:“createSpecificUser”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[“admin”,{“class”:“OC\DB\Connection”}]},{“file”:"/volume1/web/nextcloud/lib/private/Setup.php",“line”:348,“function”:“setupDatabase”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[“admin”]},{“file”:"/volume1/web/nextcloud/core/Controller/SetupController.php",“line”:72,“function”:“install”,“class”:“OC\Setup”,“type”:"->",“args”:["*** sensitive parameters replaced "]},{“file”:"/volume1/web/nextcloud/lib/base.php",“line”:935,“function”:“run”,“class”:“OC\Core\Controller\SetupController”,“type”:"->",“args”:[" sensitive parameters replaced "]},{“file”:"/volume1/web/nextcloud/index.php",“line”:42,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php",“Line”:79,“Previous”:{“Exception”:“Doctrine\DBAL\Driver\PDOException”,“Message”:“SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”,“Code”:“42000”,“Trace”:[{“file”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php",“line”:1060,“function”:“exec”,“class”:“Doctrine\DBAL\Driver\PDOConnection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”]},{“file”:"/volume1/web/nextcloud/lib/private/DB/Connection.php",“line”:216,“function”:“executeUpdate”,“class”:“Doctrine\DBAL\Connection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”,[],[]]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:104,“function”:“executeUpdate”,“class”:“OC\DB\Connection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:149,“function”:“createDBUser”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[{“class”:“OC\DB\Connection”}]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:50,“function”:“createSpecificUser”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[“admin”,{“class”:“OC\DB\Connection”}]},{“file”:"/volume1/web/nextcloud/lib/private/Setup.php",“line”:348,“function”:“setupDatabase”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[“admin”]},{“file”:"/volume1/web/nextcloud/core/Controller/SetupController.php",“line”:72,“function”:“install”,“class”:“OC\Setup”,“type”:"->",“args”:[" sensitive parameters replaced "]},{“file”:"/volume1/web/nextcloud/lib/base.php",“line”:935,“function”:“run”,“class”:“OC\Core\Controller\SetupController”,“type”:"->",“args”:[" sensitive parameters replaced "]},{“file”:"/volume1/web/nextcloud/index.php",“line”:42,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php",“Line”:43,“Previous”:{“Exception”:“PDOException”,“Message”:“SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘BY ‘…’’ at line 1”,“Code”:“42000”,“Trace”:[{“file”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php",“line”:41,“function”:“exec”,“class”:“PDO”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”]},{“file”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php",“line”:1060,“function”:“exec”,“class”:“Doctrine\DBAL\Driver\PDOConnection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”]},{“file”:"/volume1/web/nextcloud/lib/private/DB/Connection.php",“line”:216,“function”:“executeUpdate”,“class”:“Doctrine\DBAL\Connection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”,[],[]]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:104,“function”:“executeUpdate”,“class”:“OC\DB\Connection”,“type”:"->",“args”:[“CREATE USER ‘oc_admin’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘…’”]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:149,“function”:“createDBUser”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[{“class”:“OC\DB\Connection”}]},{“file”:"/volume1/web/nextcloud/lib/private/Setup/MySQL.php",“line”:50,“function”:“createSpecificUser”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[“admin”,{“class”:“OC\DB\Connection”}]},{“file”:"/volume1/web/nextcloud/lib/private/Setup.php",“line”:348,“function”:“setupDatabase”,“class”:“OC\Setup\MySQL”,“type”:"->",“args”:[“admin”]},{“file”:"/volume1/web/nextcloud/core/Controller/SetupController.php",“line”:72,“function”:“install”,“class”:“OC\Setup”,“type”:"->",“args”:[" sensitive parameters replaced "]},{“file”:"/volume1/web/nextcloud/lib/base.php",“line”:935,“function”:“run”,“class”:“OC\Core\Controller\SetupController”,“type”:"->",“args”:[" sensitive parameters replaced ***"]},{“file”:"/volume1/web/nextcloud/index.php",“line”:42,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/volume1/web/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php",“Line”:41}},“CustomMessage”:“Database user creation failed.”},“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0”,“version”:“17.0.2.1”}

How can I solve these errors?

I use PHP 7.3, MariaDB 10 and Apache 2.4.

Hello,

I don’t know if you already solve the problem, but I faced the same issue when I has trying to install nextcloud yesterday.

The issue is a bug in the last version of nextcloud server (17.0.2), there is a github issue here.

To solve the problem you need to install the previous version that you can find here or directly download the zip file.

Remove the nextcloud folder you have and start the tutorial where the author asks you to download the nexcloud zip, download the previous version and follow the next steps.

That solves the the problem. Thanks!