forked from brianmario/mysql2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis_setup.sh
37 lines (30 loc) · 909 Bytes
/
.travis_setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -eu
# Install MySQL 5.7 if DB=mysql57
if [[ -n ${DB-} && x$DB =~ mysql57 ]]; then
sudo bash .travis_mysql57.sh
fi
# Install MariaDB if DB=mariadb
if [[ -n ${DB-} && x$DB =~ xmariadb ]]; then
sudo bash .travis_mariadb.sh "$DB"
fi
# Install MySQL if OS=darwin
if [[ x$OSTYPE =~ ^xdarwin ]]; then
brew update
brew install "$DB"
$(brew --prefix "$DB")/bin/mysql.server start
fi
# TODO: get SSL working on OS X in Travis
if ! [[ x$OSTYPE =~ ^xdarwin ]]; then
sudo bash .travis_ssl.sh
sudo service mysql restart
fi
sudo mysql -e "CREATE USER '$USER'@'localhost'" || true
# Print the MySQL version and create the test DB
if [[ x$OSTYPE =~ ^xdarwin ]]; then
$(brew --prefix "$DB")/bin/mysqld --version
$(brew --prefix "$DB")/bin/mysql -u $USER -e "CREATE DATABASE IF NOT EXISTS test"
else
mysqld --version
mysql -u $USER -e "CREATE DATABASE IF NOT EXISTS test"
fi