I am unable to do a simple migration in CircleCI. It keep saying it cannot connect to database
#!/bin/bash -eo pipefail
bin/cake migrations migrate
using migration paths
- /var/www/html/config/Migrations
using seed paths
- /var/www/html/config/Seeds
Exception: There was a problem connecting to the database: SQLSTATE[HY000] [2002] Connection refused
In [/var/www/html/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php, line 83]
2020-10-27 16:14:26 Error: [InvalidArgumentException] There was a problem connecting to the database: SQLSTATE[HY000] [2002] Connection refused in /var/www/html/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 83
Stack Trace:
What could be the problem? the following is my config.yml
version: 2
jobs:
build:
docker:
- image: mosesliao/php:timesheet
environment:
DEBUG: true
DATABASE_URL: "mysql://root:password@127.0.0.1/timesheet?encoding=utf8mb4&timezone=UTC&cacheMetadata=true"
DATABASE_TEST_URL: "mysql://root:password@127.0.0.1/timesheet?encoding=utf8mb4&timezone=UTC&cacheMetadata=true"
SECURITY_SALT: aAEfxtXyx66ATQ09dSAs2dRXd5njiORl
- image: mysql:5.6.36
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
environment:
MYSQL_DATABASE: timesheet
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: password
working_directory: /var/www/html
steps:
- checkout
- run:
name: composer setup
command: |
composer self-update
composer install --no-interaction --ignore-platform-reqs
- run:
name: Initialize Database
command: bin/cake migrations migrate
- run:
name: phpunit testing
command: vendor/bin/phpunit --coverage-clover=coverage.xml
- run:
name: codecov upload
command: bash <(curl -s https://codecov.io/bash)
workflows:
version: 2
build-and-deploy:
jobs:
- build