Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Mysql 5.7 with Travis CI

I can't run my tests on Travis CI because i can't find a way to setup mysql 5.7 in container.

I've found this gist https://gist.github.com/BenMorel/d981f25ead0926a0cb6d explaining a configuration method for travis.yml. Here are the commands :

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

right after that, I'm doing :

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

Why ?? I've tried so many things… And Google is definitely not my friend for this issue…

like image 364
Philippe CARLE Avatar asked Jan 16 '16 20:01

Philippe CARLE


1 Answers

Ok I've found out how to reinstall MySQL 5.6 in Travis CI default container.

Here is what is needed in .travis.yml:

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

And here is the .travis.install-mysql-5.7.sh (edited thanks to @codyzu answer):

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

I hope it would help anyone facing the same issue !

like image 77
Philippe CARLE Avatar answered Oct 14 '22 01:10

Philippe CARLE