diff --git a/.travis.yml b/.travis.yml index b0343d457..4c86ff305 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,11 +64,12 @@ matrix: addons: hosts: - mysql2gem.example.com - apt: - packages: - - mysql-server-5.7 - - mysql-client-core-5.7 - - mysql-client-5.7 + # https://github.com/travis-ci/travis-ci/issues/5122 + # apt: + # packages: + # - mysql-server-5.7 + # - mysql-client-core-5.7 + # - mysql-client-5.7 - rvm: 2.0.0 env: DB=mysql55 os: osx diff --git a/.travis_mysql57.sh b/.travis_mysql57.sh index e7e6f0a45..96183ea27 100644 --- a/.travis_mysql57.sh +++ b/.travis_mysql57.sh @@ -1,20 +1,12 @@ #!/usr/bin/env bash -set -eu - -service mysql stop -apt-get purge '^mysql*' 'libmysql*' -apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x8C718D3B5072E1F5 +set -eux +apt-get purge -qq '^mysql*' '^libmysql*' +apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5 add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7' +apt-get update -qq +apt-get install -qq mysql-server libmysqlclient-dev -apt-get update -apt-get -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y install mysql-server libmysqlclient-dev - -mysql_upgrade -u root --force --upgrade-system-tables - -# Replace the final line of the mysql apparmor, allowing /etc/mysql/*.pem -sed -ie '$ s|}|\ - /etc/mysql/*.pem r,\ -}|' /etc/apparmor.d/usr.sbin.mysqld -service apparmor restart +# https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/ +mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''" diff --git a/.travis_setup.sh b/.travis_setup.sh index 42d56cd79..5b562f192 100644 --- a/.travis_setup.sh +++ b/.travis_setup.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -eu +set -eux # Install MySQL 5.7 if DB=mysql57 if [[ -n ${DB-} && x$DB =~ ^xmysql57 ]]; then @@ -20,15 +20,12 @@ if ! [[ x$OSTYPE =~ ^xdarwin ]]; then sudo service mysql restart fi -sudo mysql -u root -e "CREATE USER '$USER'@'localhost'" || true -sudo mysql -u root -e "GRANT ALL ON test.* TO '$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" + $(brew --prefix "$DB")/bin/mysql -u root -e 'CREATE DATABASE IF NOT EXISTS test' else mysqld --version # IF NOT EXISTS is mariadb-10+ only - https://mariadb.com/kb/en/mariadb/comment-syntax/ - mysql -u $USER -e "CREATE DATABASE /*M!50701 IF NOT EXISTS */ test" + mysql -u root -e 'CREATE DATABASE /*M!50701 IF NOT EXISTS */ test' fi diff --git a/.travis_ssl.sh b/.travis_ssl.sh index d022e9570..e98f27a44 100644 --- a/.travis_ssl.sh +++ b/.travis_ssl.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -eu +set -eux # Make sure there is an /etc/mysql mkdir -p /etc/mysql diff --git a/spec/configuration.yml.example b/spec/configuration.yml.example index 5a4406fc7..6024a1ce9 100644 --- a/spec/configuration.yml.example +++ b/spec/configuration.yml.example @@ -9,9 +9,3 @@ user: username: LOCALUSERNAME password: database: mysql2_test - -numericuser: - host: localhost - username: LOCALUSERNAME - password: - database: 12345 diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb index 2561ce813..15813bce4 100644 --- a/spec/mysql2/client_spec.rb +++ b/spec/mysql2/client_spec.rb @@ -263,13 +263,14 @@ def run_gc end it "should be able to connect to database with numeric-only name" do - creds = DatabaseCredentials['numericuser'] - @client.query "CREATE DATABASE IF NOT EXISTS `#{creds['database']}`" - @client.query "GRANT ALL ON `#{creds['database']}`.* TO #{creds['username']}@`#{creds['host']}`" + database = 1235 + @client.query "CREATE DATABASE IF NOT EXISTS `#{database}`" - expect { Mysql2::Client.new(creds) }.not_to raise_error + expect { + Mysql2::Client.new(DatabaseCredentials['root'].merge('database' => database)) + }.not_to raise_error - @client.query "DROP DATABASE IF EXISTS `#{creds['database']}`" + @client.query "DROP DATABASE IF EXISTS `#{database}`" end it "should respond to #close" do diff --git a/spec/ssl/gen_certs.sh b/spec/ssl/gen_certs.sh index d55872d0f..728748126 100644 --- a/spec/ssl/gen_certs.sh +++ b/spec/ssl/gen_certs.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -eu +set -eux echo " [ ca ]