Skip to content

Commit 39901da

Browse files
committed
Travis: install mysql-5.7 "manually"
See travis-ci/travis-ci#5122
1 parent ba805ce commit 39901da

7 files changed

+24
-39
lines changed

.travis.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ matrix:
6464
addons:
6565
hosts:
6666
- mysql2gem.example.com
67-
apt:
68-
packages:
69-
- mysql-server-5.7
70-
- mysql-client-core-5.7
71-
- mysql-client-5.7
67+
# https://github.com/travis-ci/travis-ci/issues/5122
68+
# apt:
69+
# packages:
70+
# - mysql-server-5.7
71+
# - mysql-client-core-5.7
72+
# - mysql-client-5.7
7273
- rvm: 2.0.0
7374
env: DB=mysql55
7475
os: osx

.travis_mysql57.sh

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
#!/usr/bin/env bash
22

3-
set -eu
4-
5-
service mysql stop
6-
apt-get purge '^mysql*' 'libmysql*'
7-
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x8C718D3B5072E1F5
3+
set -eux
84

5+
apt-get purge -qq '^mysql*' '^libmysql*'
6+
apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5
97
add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7'
8+
apt-get update -qq
9+
apt-get install -qq mysql-server libmysqlclient-dev
1010

11-
apt-get update
12-
apt-get -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y install mysql-server libmysqlclient-dev
13-
14-
mysql_upgrade -u root --force --upgrade-system-tables
15-
16-
# Replace the final line of the mysql apparmor, allowing /etc/mysql/*.pem
17-
sed -ie '$ s|}|\
18-
/etc/mysql/*.pem r,\
19-
}|' /etc/apparmor.d/usr.sbin.mysqld
20-
service apparmor restart
11+
# https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/
12+
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''"

.travis_setup.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -eu
3+
set -eux
44

55
# Install MySQL 5.7 if DB=mysql57
66
if [[ -n ${DB-} && x$DB =~ ^xmysql57 ]]; then
@@ -20,15 +20,12 @@ if ! [[ x$OSTYPE =~ ^xdarwin ]]; then
2020
sudo service mysql restart
2121
fi
2222

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-
2623
# Print the MySQL version and create the test DB
2724
if [[ x$OSTYPE =~ ^xdarwin ]]; then
2825
$(brew --prefix "$DB")/bin/mysqld --version
29-
$(brew --prefix "$DB")/bin/mysql -u $USER -e "CREATE DATABASE IF NOT EXISTS test"
26+
$(brew --prefix "$DB")/bin/mysql -u root -e 'CREATE DATABASE IF NOT EXISTS test'
3027
else
3128
mysqld --version
3229
# 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"
30+
mysql -u root -e 'CREATE DATABASE /*M!50701 IF NOT EXISTS */ test'
3431
fi

.travis_ssl.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -eu
3+
set -eux
44

55
# Make sure there is an /etc/mysql
66
mkdir -p /etc/mysql

spec/configuration.yml.example

-6
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,3 @@ user:
99
username: LOCALUSERNAME
1010
password:
1111
database: mysql2_test
12-
13-
numericuser:
14-
host: localhost
15-
username: LOCALUSERNAME
16-
password:
17-
database: 12345

spec/mysql2/client_spec.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,14 @@ def run_gc
263263
end
264264

265265
it "should be able to connect to database with numeric-only name" do
266-
creds = DatabaseCredentials['numericuser']
267-
@client.query "CREATE DATABASE IF NOT EXISTS `#{creds['database']}`"
268-
@client.query "GRANT ALL ON `#{creds['database']}`.* TO #{creds['username']}@`#{creds['host']}`"
266+
database = 1235
267+
@client.query "CREATE DATABASE IF NOT EXISTS `#{database}`"
269268

270-
expect { Mysql2::Client.new(creds) }.not_to raise_error
269+
expect {
270+
Mysql2::Client.new(DatabaseCredentials['root'].merge('database' => database))
271+
}.not_to raise_error
271272

272-
@client.query "DROP DATABASE IF EXISTS `#{creds['database']}`"
273+
@client.query "DROP DATABASE IF EXISTS `#{database}`"
273274
end
274275

275276
it "should respond to #close" do

spec/ssl/gen_certs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -eu
3+
set -eux
44

55
echo "
66
[ ca ]

0 commit comments

Comments
 (0)