11#! /usr/bin/env bash
22
3- set -eu
3+ set -eux
4+
5+ # Install MySQL 5.1 if DB=mysql51
6+ if [[ -n ${DB-} && x$DB =~ ^xmysql51 ]]; then
7+ sudo bash .travis_mysql51.sh
8+ fi
49
510# Install MySQL 5.7 if DB=mysql57
611if [[ -n ${DB-} && x$DB =~ ^xmysql57 ]]; then
712 sudo bash .travis_mysql57.sh
813fi
914
15+ # Install MySQL 8.0 if DB=mysql80
16+ if [[ -n ${DB-} && x$DB =~ ^xmysql80 ]]; then
17+ sudo bash .travis_mysql80.sh
18+ fi
19+
20+ # Install MariaDB 10.2 if DB=mariadb10.2
21+ # NOTE this is a workaround until Travis CI merges a fix to its mariadb addon.
22+ if [[ -n ${DB-} && x$DB =~ ^xmariadb10.2 ]]; then
23+ sudo apt-get install -y -o Dpkg::Options::=' --force-confnew' mariadb-server mariadb-server-10.2 libmariadbclient18
24+ fi
25+
1026# Install MySQL if OS=darwin
1127if [[ x$OSTYPE =~ ^xdarwin ]]; then
1228 brew update
13- brew install " $DB "
29+ brew install " $DB " mariadb-connector-c
1430 $( brew --prefix " $DB " ) /bin/mysql.server start
1531fi
1632
@@ -20,15 +36,12 @@ if ! [[ x$OSTYPE =~ ^xdarwin ]]; then
2036 sudo service mysql restart
2137fi
2238
23- sudo mysql -u root -e " CREATE USER '$USER '@'localhost'" || true
24- sudo mysql -u root -e " GRANT ALL ON test.* TO '$USER '@'localhost'" || true
25-
2639# Print the MySQL version and create the test DB
2740if [[ x$OSTYPE =~ ^xdarwin ]]; then
2841 $( brew --prefix " $DB " ) /bin/mysqld --version
29- $( brew --prefix " $DB " ) /bin/mysql -u $USER -e " CREATE DATABASE IF NOT EXISTS test"
42+ $( brew --prefix " $DB " ) /bin/mysql -u root -e ' CREATE DATABASE IF NOT EXISTS test'
3043else
3144 mysqld --version
3245 # IF NOT EXISTS is mariadb-10+ only - https://mariadb.com/kb/en/mariadb/comment-syntax/
33- mysql -u $USER -e " CREATE DATABASE /*M!50701 IF NOT EXISTS */ test"
46+ mysql -u root -e ' CREATE DATABASE /*M!50701 IF NOT EXISTS */ test'
3447fi
0 commit comments