Setup mysql database for testing specific on ubuntu 14.04

hi @everyone, i have issues running tests with phpunit

'circle' => [
		'driver' => 'mysql',
		'host' => '127.0.0.1',
		'database' => 'circle_test',
		'username' => 'ubuntu',
		'password' => '',
		'charset' => 'utf8',
		'collation' => 'utf8_unicode_ci',
		'prefix' => '',
	],

and my circle.yml file:

    machine:

  pre:
    - curl -s https://packagecloud.io/install/repositories/circleci/trusty/script.deb.sh | sudo bash
    - sudo apt-get install circleci-php-7.0.4=4

  php:
    version: 7.0.4

  services:
    - mysql

  hosts:
    athliit.app: 127.0.0.1

  environment:
    APP_ENV: testing
    APP_URL: 127.0.0.1
    DB_HOST: 127.0.0.1
    DB_URL: 127.0.0.1
    DB_NAME: circle_test
    DB_USER: ubuntu

database:
  override:
    - mysql -u ubuntu -e "create database circle_test"
    - mysql -u ubuntu  circle_test < circle_test.sql
 
dependencies:
  pre:
    - echo "BUGSNAG_API_KEY=c7aa370da4f48326136b134cfcb27202" >> .env
    - echo "DB_HOST=127.0.0.1" >> .env
  override:
    - composer install
    - php artisan migrate

anyone that maybe can point me in some right direction of this issue
any help is appreciated

cheers

Can you clarify what specific issues you are running into?

im getting:

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO)

and i can imagine, its a mix of my configuration in config/database.php and some ENV Variables

any hints ?

The default user is ubuntu with no password and the name of the database is circle_test. If you want to use other usernames and other database names then you need to create them as a part of your build.

1 Like