continuous-integration - 使用 Travis CI 配置 Mysql 5.7

标签 continuous-integration travis-ci mysql-5.7

我无法在 Travis CI 上运行我的测试,因为我找不到在容器中设置 mysql 5.7 的方法。

我找到了这个要点 https://gist.github.com/BenMorel/d981f25ead0926a0cb6d解释travis.yml的配置方法.以下是命令:

sudo apt-get remove --purge "^mysql.*"
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /var/log/mysql
echo mysql-apt-config mysql-apt-config/enable-repo select mysql-5.7-dmr | sudo debconf-set-selections
wget http://dev.mysql.com/get/mysql-apt-config_0.2.1-1ubuntu12.04_all.deb
sudo dpkg --install mysql-apt-config_0.2.1-1ubuntu12.04_all.deb
sudo apt-get update -q
sudo apt-get install -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" mysql-server

在那之后,我正在做:

$ mysql -uroot < tests/ApiBundle/Datas/dump_test.sql
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

为什么 ??我已经尝试了很多东西……而且在这个问题上,谷歌绝对不是我的 friend ……

最佳答案

好的,我已经找到了如何在 Travis CI 默认容器中重新安装 MySQL 5.6。

这是.travis.yml 中需要的内容:

services:
  - mysql
sudo: true
before_script:
  - bash .travis.install-mysql-5.7.sh

这是 .travis.install-mysql-5.7.sh (编辑感谢@codyzu 回答):

echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
wget https://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
sudo dpkg --install mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update -q
sudo apt-get install -q -y --allow-unauthenticated -o Dpkg::Options::=--force-confnew mysql-server
sudo mysql_upgrade

我希望它能帮助任何面临同样问题的人!

关于continuous-integration - 使用 Travis CI 配置 Mysql 5.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34831695/

相关文章:

continuous-integration - 如何配置 Hudson 以在端口 80 上运行?

continuous-integration - 如何在 Team City 中运行所有 NUnit 测试?

continuous-integration - GitLab CI 无法安装/使用 PhantomJS

django - 在 Travis 上运行 django unittests 时如何解决 "psycopg2.errors.UndefinedTable: relation "auth_user“不存在”

amazon-web-services - IAM 角色增加超过最大配额限制

android - TravisCI Android 构建失败

python - Travis 对每个 python 版本的特殊要求

Mysql 在使用索引条件自连接表时不使用索引

php - 在特定 id 之后插入第二列到 csv

mysql - 处理没有索引的非常大的表