symfony - Travis 在 Symfony 4 下构建失败创建数据库
问题描述
我的 Travis 构建失败并出现此错误
php bin/console 学说:数据库:create --env=test 在 AbstractMySQLDriver.php 第 93 行:
驱动程序中发生异常:SQLSTATE[HY000] [1045] 用户 'db_user'@'localhost' 的访问被拒绝(使用密码:YES )
这是我的 travis.yml
# Project language
language: php
# Allows use container-based infrastructure
sudo: false
# Start mysql service
services:
- mysql
# Cache composer packages so "composer install" is faster
cache:
directories:
- $HOME/.composer/cache/files
# Matrix to test in every php version
matrix:
# Fast finish allows to set the build as "finished" even if the "allow_failures" matrix elements are not finished yet.
fast_finish: true
include:
- php: 7.3.5
- php: hhvm
allow_failures:
- php: hhvm
# Define an environment variable
env:
- SYMFONY_VERSION="4.7.*" DB=mysql
# Update composer
before-install:
- composer self-update
# Install composer dependencies,
# Create database, schema and fixtures
install:
- composer install
- php bin/console doctrine:database:create --env=test
- php bin/console doctrine:schema:create --env=test
- php bin/console doctrine:fixtures:load -n --env=test
# Run script
script:
- phpunit
# After a build, send email notification with the build results
notifications:
email: ...@.....fr
谢谢你的帮助。
解决方案
我认为错误很明显Access denied for user 'db_user'@'localhost' (using password: YES)
:)
您是否检查了Travis CI 中 mysql 服务的用户是travis
还是root
?(还要检查密码)
推荐阅读
- node.js - Postgres NodeJS 批量更新插入超时
- javascript - 用数据 ASP.NET CORE MVC Jquery 填充弹出模式
- php - Windows Server (IIS) + PHP7.4 - curl 的问题
- python - 无法将 chromedriver page_source 写入文件
- javascript - Discord.js Bot 在启动时抛出错误。我该如何解决?
- sql - 上一个值的 SQL 帮助
- angular - 单元测试 Angular:当多次使用 control.setValue(...) 时,valueChanges 仅在测试结束时触发
- visual-studio - 找不到 dll 视觉工作室
- android - 在 Google Play 商店更新 android 应用时,现有数据库消失
- javascript - 如何在nodejs的for循环中使用.then或await?