Setting up mysql 5.7 environment variables - Access denied for user (Laravel project)

I have gotten to this again:

SQLSTATE[HY000] [2002] Connection refused (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

With config

# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/php:7.2-apache-stretch-node-browsers
        environment:
          MYSQL_ROOT_PASSWORD: password

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mysql:9.4

    steps:
      - checkout

      - run: sudo apt-get install -y libzip-dev
      - run: sudo docker-php-ext-install zip
      - run: sudo apt-get update
      - run: sudo apt-get install -y zlib1g-dev libicu-dev g++
      - run: sudo docker-php-ext-configure intl
      - run: sudo docker-php-ext-install intl
      - run: sudo docker-php-ext-install pdo_mysql
      - run: sudo apt-get install mysql-server
      - run: sudo apt-get install mysql-client
      - run: sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password password'
      - run: sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password password'
      - run: sudo apt-get -y install mysql-server

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "composer.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: composer install -n --prefer-dist

      - save_cache:
          paths:
            - ./vendor
          key: v1-dependencies-{{ checksum "composer.json" }}

      # run tests!
      - run: ./vendor/bin/phpunit

Ahh… hang on… Nothing revolutionary. Just should not have had that line run: sudo apt-get install mysql-server before those other lines :smiley:

Also saw this…Laravel php artisan mysql connection refused