Access denied to MariaDB. Any suggestions?

Steps to reproduce
1. apt-get install owncloud
2. apt-get install mariadb-server
3. "Finish setup" Installation wizard using MySQL/MariaDB

Expected behaviour
Installation wizard completes normally.

Actual behaviour
Msg "Error while trying to create admin user:
Failed to connect to database:
An exception occurred in driver:
SQLSTATE[HY000][1698] Access denied for user 'ocdbadmin'@'localhost'

Server configuration
Operating system: Ubuntu 16.04
Web server: Apache2
Database: MySQL/MariaDB
PHP version: PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
ownCloud version (see ownCloud admin page): owncloud-9.1.1-1.2
Updated from an older ownCloud or fresh install: Fresh install
ownCloud log (data/owncloud.log, see https://central.owncloud.org/t/how-to-find-webserver-or-oc-logfile-enable-php-logfile/808):
[Sun Oct 02 03:48:07.479133 2016] [authz_core:error] [pid 22139] [client 127.0.0.1:42934] AH01630: client denied by server configuration: /var/www/owncloud/data/htaccesstest.txt

ls -la /var/www/owncloud/data/ does not show htaccesstest.txt present.

Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): None known

Hi,

as explained in https://doc.owncloud.org/server/9.1/admin_manual/installation/installation_wizard.html#database-choice its recommended to use the root user for the setup wizard and oC will create the necessary (less privileged) database user and database during the installation. With that you shouldn't see this issue.

"recommended to use the root user"

In case anybody else happens to read this entry, I found the following instructions helpful. In Terminal:

sudo mysql --user=root mysql

CREATE USER 'dbadmin'@'localhost' IDENTIFIED BY 'Apassword';
GRANT ALL PRIVILEGES ON *.* TO 'dbadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

exit

Then use "dbadmin" & "Apassword" for the "setup [installation] wizard". Oc then creates the "oc_dbadmin" user in the config.php for future use.

1 Like

worked for me too thanks.