Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to mariadb suddenly - Error 500 #647

Closed
rickygarg opened this issue Feb 12, 2019 · 1 comment
Closed

Unable to connect to mariadb suddenly - Error 500 #647

rickygarg opened this issue Feb 12, 2019 · 1 comment

Comments

@rickygarg
Copy link

I'm suddenly facing an issue today morning similar to #395 and #636 with the following logs:

PHP Fatal error: Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused in /var/www/html/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\\DB\\Connection->connect()\n#1 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\\DBAL\\Connection->getDatabasePlatformVersion()\n#2 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\\DBAL\\Connection->detectDatabasePlatform()\n#3 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\\DBAL\\Connection->getDatabasePlatform()\n#4 /var/www/html/lib/private/DB/Connection.php(151): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#5 /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__construct(Array, Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Object(Doctrine\\DBAL\\Configuration), Object(D in /var/www/html/lib/private/DB/Connection.php on line 64

However, manually changing the my.cnf (https://help.nextcloud.com/t/nextcloud-13-php-7-1-mysql-8-error-500/34443), or adding a command on docker-compose (#395) doesn't resolve or change the error log:

command: --default_authentication_plugin=mysql_native_password

I run nextcloud through the official instructions on help, and can access the mariadb instance normally from the nextcloud container using a mysql client (freshly installed to test). As mentioned, I didn't update the image - the issue suddenly propped up today morning. However, I tried afterwards a docker pull nextcloud:latest but the issue prevails.

@rickygarg
Copy link
Author

This is resolved. I had used the Nextcloud wizard to setup the database connection where I provided the docker IP address for the DB container. On a container restart, docker assigned new IP addresses making the db address in config.php incorrect. I have now replaced the docker internal IP address with the container name 'db'.

Not sure if I missed this from the documentation, as I already had a link to the db in my docker-compose.yml:

app: container_name: nextcloud image: nextcloud:latest expose: - "80" links: - db depends_on: - "nginx-proxy" - "db"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant