SQLSTATE[HY000] [2002] Connection refused error when running Shlink CLI #2372
-
Shlink version4 PHP version8 How do you serve ShlinkDocker image Database engineMariaDB Database version10.8 SummaryHello everyone! sudo docker exec shlink-backend shlink api-key:generate
In ServiceManager.php line 649:
Service with name "Shlinkio\Shlink\Rest\ApiKey\Repository\ApiKeyRepository"
could not be created. Reason: An exception occurred in the driver: SQLSTAT
E[HY000] [2002] Connection refused
In ExceptionConverter.php line 80:
An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refu
sed
In Exception.php line 24:
SQLSTATE[HY000] [2002] Connection refused
In PDOConnect.php line 25:
SQLSTATE[HY000] [2002] Connection refused
exit status 255 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This doesn't seem to be related with API keys specifically, but rather a misconfiguration that is preventing Shlink from connecting to the database. Can you share your docker-compose file and provide some steps to reproduce it? |
Beta Was this translation helpful? Give feedback.
@Rol-a the problem is that you forgot to link the Shlink and the database containers:
With that it works.