Installation: Access denied

Hi all,

I create the account, I can log in with mysql -uuser without problem.

But when I try to install I get “You need to enter details of an existing account.”.

When using “sudo -u www-data php occ maintenance:install …” I get:

MySQL username and/or password not valid
→ You need to enter details of an existing account.

Trace: #0 /var/www/html/nextcloud/lib/private/Setup.php(353): OC\Setup\MySQL->setupDatabase()
#1 /var/www/html/nextcloud/core/Command/Maintenance/Install.php(105): OC\Setup->install()
#2 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Maintenance\Install->execute()
#3 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#4 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#5 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#6 /var/www/html/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run()
#7 /var/www/html/nextcloud/console.php(100): OC\Console\Application->run()
#8 /var/www/html/nextcloud/occ(11): require_once(‘…’)
#9 {main}

Previous: Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘tom_nextcloud’@‘localhost’ (using password: YES)
Trace: #0 /var/www/html/nextcloud/lib/private/Setup/MySQL.php(64): OC\DB\Connection->connect()
#1 /var/www/html/nextcloud/lib/private/Setup.php(353): OC\Setup\MySQL->setupDatabase()
#2 /var/www/html/nextcloud/core/Command/Maintenance/Install.php(105): OC\Setup->install()
#3 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Maintenance\Install->execute()
#4 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#5 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#6 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#7 /var/www/html/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run()
#8 /var/www/html/nextcloud/console.php(100): OC\Console\Application->run()
#9 /var/www/html/nextcloud/occ(11): require_once(‘…’)

Any idea?
The user has all privileges, eg I did :

GRANT ALL ON tom_nextcloud.* TO ‘tom_nextcloud’@‘localhost’ ;

But still the same error… Any idea?

Did you actually pass the username and password for the database with the command?

A working command would look like this:

sudo -u www-data php /var/www/html/nextcloud/occ maintenance:install --database "mysql" --database-name "ncdb" --database-user "ncdbuser" --database-pass "ncdbpassword" --admin-user "Nextcloud-Admin-User" --admin-pass "admin-password" --data-dir "/var/ncdata"

Does it work if you are using the Web based installer? Installation wizard — Nextcloud latest Administration Manual latest documentation

Yes I did, the full command :

sudo -u www-data php occ maintenance:install --database “mysql” --database-name “tom_nextcloud” --database-user “tom_nextcloud” --database-pass “XXXX” --admin-user “root” --admin-pass “YYY”

The web based installation just gives the first error (in french, sorry)
image

Thanks for the quick answer !

Are there maybe any special characters in the password like for example forward or back slashes. I would avoid them. it is more trouble-free if you are using only alphanumeric characters and make the passwords longer instead. If you are using special characters, make sure that you put the password in quotes while creating the database user, like this:

CREATE USER ncdbuser@localhost IDENTIFIED BY 'ncdbpassword';

Other than that I’m not sure. I’m not exactly a database expert. Maybe others here have more ideas…

The password has nothing specific.

However I removed the config.php and re-started again the installation and this time it worked.

It seems that those parameters in command line are overwritten by the config.php that was created on the first try?

Fixed for me but there might be a bug there :slight_smile:

1 Like