Laravel 4.2 + MySQL在Codeship上运行phpunit说'..访问被拒绝用户root @ localhost ..'

时间:2015-08-14 10:04:42

标签: laravel-4 codeship

我在bitbucket上集成了一个带有MySQL Web应用程序的Laravel 4.2,并决定使用Codeship进行持续集成。

当在Codeship上执行构建时,它会说''对用户root @ localhost拒绝访问..'

这是我的Codeship命令:

# Set php version through phpenv. 5.3, 5.4 and 5.5 available
phpenv local 5.4
# Install extensions through Pecl
# yes yes | pecl install memcache
# Install dependencies through Composer
composer install --prefer-source --no-interaction

这是Codeship测试命令:

phpunit

谢谢!

2 个答案:

答案 0 :(得分:0)

    check you configuration file and be sure the driver, hostname,username,password corresponds to what you have configured in file your-app/config/database.php example is what you have below

'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'foo',
            'username'  => 'bar',
            'password'  => '',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),

答案 1 :(得分:0)

解决:
设置命令

# Set php version through phpenv. 5.3, 5.4 and 5.5 available
phpenv local 5.4
# Install extensions through Pecl
# yes yes | pecl install memcache
# Install dependencies through Composer
composer install --prefer-source --no-interaction
php artisan migrate
php artisan db:seed

测试命令

phpunit

环境变量

APP_ENV = codeship 
APP_HOST = localhost 
APP_DB = test 

参考:http://laravelista.com/laravel-codeception-tests-on-codeship-and-windows/