Sync the test DB setup logic with upstream.

Reset password for the root user due to MariaDB 10.4 authentication
change.
https://mariadb.com/kb/en/authentication-from-mariadb-104/#altering-the-user-account-to-revert-to-the-previous-authentication-method

Relevant links:
ffdd8c6c67/tasks/rspec.rake (L37-L59)
https://github.com/brianmario/mysql2/blob/master/ci/setup.sh
This commit is contained in:
Jarek Prokop 2022-04-28 13:54:54 +02:00
parent 23a87cbbd6
commit b6f85bc7e5

View File

@ -120,8 +120,15 @@ for i in $(seq 10); do
echo "Waiting connections... ${i}" echo "Waiting connections... ${i}"
done done
# Reset password for the root user due to MariaDB 10.4 authentication change.
# See https://mariadb.com/kb/en/authentication-from-mariadb-104/#altering-the-user-account-to-revert-to-the-previous-authentication-method
mysql -u ${MYSQL_TEST_USER} \
-e "ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('')" \
-S "${MYSQL_TEST_SOCKET}" \
-P "${MYSQL_TEST_PORT}"
# See https://github.com/brianmario/mysql2/blob/master/.travis_setup.sh # See https://github.com/brianmario/mysql2/blob/master/.travis_setup.sh
mysql -u $MYSQL_TEST_USER \ mysql -u root \
-e 'CREATE DATABASE /*M!50701 IF NOT EXISTS */ test' \ -e 'CREATE DATABASE /*M!50701 IF NOT EXISTS */ test' \
-S "${MYSQL_TEST_SOCKET}" \ -S "${MYSQL_TEST_SOCKET}" \
-P "${MYSQL_TEST_PORT}" -P "${MYSQL_TEST_PORT}"
@ -130,7 +137,7 @@ mysql -u $MYSQL_TEST_USER \
cat <<EOF > spec/configuration.yml cat <<EOF > spec/configuration.yml
root: root:
host: localhost host: localhost
username: ${MYSQL_TEST_USER} username: root
password: password:
database: test database: test
port: ${MYSQL_TEST_PORT} port: ${MYSQL_TEST_PORT}