• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Unable to connect to database

Pentarou

Basic Pleskian
Hello,

I have downloaded and installed the latest NextCloud docker image and set the port and firewall configurations properly. I am welcomed by the NextCloud installer and choose to use the MySQL / MariaDB database and made sure that I entered the correct login details. However, NextCloud could not connect to the database with the following error:

Code:
Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory

I suspect it is a firewall issue nonetheless, does anyone have an idea how to fix it?

Thank you in in advance!
 
  1. Produce a MySQL Dump (mysqldump -u username -p --all-databases > dump.sql)
  2. Delete all mysql-packages (dpkg --purge mysql...)
  3. Reinstall mysql
mysql -u root -p

CREATE DATABASE owncloud;
GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'set_database_password';
FLUSH PRIVILEGES;

  1. Restore MySQL Dump (mysql -u username -p database_name < dump.sql)
  2. Backup /var/www/owncloud/config + /var/www/owncloud/data
  3. Delete all owncloud* Packages
  4. Reinstall owncloud
  5. Restore /var/www/owncloud/config + /var/www/owncloud/data from backup
How To Install and Configure ownCloud on Ubuntu 16.04 | DigitalOcean
 
Hello m3lezZ, and thank you kindly for your reply.

I do not think that reinstalling the database will help. I found this article that suggests that I use the server IP and port number as the address of the database server, which I have tried, and gave me the following error:

Code:
Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused

Again it seems that it is a firewall problem, but my database is configured to allow remote connections from any host, so I'm a bit confused.
 
There is no such file, but /etc/init.d/psa-firewall, which you can view here.

I can't reach port 3306 from Powershell, so at least I know it's a firewall issue now.
 
Back
Top