|
2 | 2 |
|
3 | 3 | set -eux
|
4 | 4 |
|
5 |
| -CHANGED_PWD=false |
6 |
| -# Change the password recreating the root user on mariadb < 10.2 |
| 5 | +# Change the password to be empty. |
| 6 | +CHANGED_PASSWORD=false |
| 7 | +# Change the password to be empty, recreating the root user on mariadb < 10.2 |
7 | 8 | # where ALTER USER is not available.
|
8 | 9 | # https://stackoverflow.com/questions/56052177/
|
9 |
| -CHANGED_PWD_BY_RECREATE=false |
| 10 | +CHANGED_PASSWORD_BY_RECREATE=false |
10 | 11 |
|
11 | 12 | # Install the default used DB if DB is not set.
|
12 | 13 | if [[ -n ${GITHUB_ACTIONS-} && -z ${DB-} ]]; then
|
13 | 14 | if command -v lsb_release > /dev/null; then
|
14 | 15 | case "$(lsb_release -cs)" in
|
15 | 16 | xenial | bionic)
|
16 | 17 | sudo apt-get install -qq mysql-server-5.7 mysql-client-core-5.7 mysql-client-5.7
|
17 |
| - CHANGED_PWD=true |
| 18 | + CHANGED_PASSWORD=true |
18 | 19 | ;;
|
19 | 20 | focal)
|
20 | 21 | sudo apt-get install -qq mysql-server-8.0 mysql-client-core-8.0 mysql-client-8.0
|
21 |
| - CHANGED_PWD=true |
| 22 | + CHANGED_PASSWORD=true |
22 | 23 | ;;
|
23 | 24 | *)
|
24 | 25 | ;;
|
|
34 | 35 | # Install MySQL 5.7 if DB=mysql57
|
35 | 36 | if [[ -n ${DB-} && x$DB =~ ^xmysql57 ]]; then
|
36 | 37 | sudo bash .travis_mysql57.sh
|
37 |
| - CHANGED_PWD=true |
| 38 | + CHANGED_PASSWORD=true |
38 | 39 | fi
|
39 | 40 |
|
40 | 41 | # Install MySQL 8.0 if DB=mysql80
|
41 | 42 | if [[ -n ${DB-} && x$DB =~ ^xmysql80 ]]; then
|
42 | 43 | sudo bash .travis_mysql80.sh
|
43 |
| - CHANGED_PWD=true |
| 44 | + CHANGED_PASSWORD=true |
44 | 45 | fi
|
45 | 46 |
|
46 | 47 | # Install MariaDB client headers after Travis CI fix for MariaDB 10.2 broke earlier 10.x
|
47 | 48 | if [[ -n ${DB-} && x$DB =~ ^xmariadb10.0 ]]; then
|
48 | 49 | if [[ -n ${GITHUB_ACTIONS-} ]]; then
|
49 | 50 | sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.0 libmariadb2
|
50 |
| - CHANGED_PWD_BY_RECREATE=true |
| 51 | + CHANGED_PASSWORD_BY_RECREATE=true |
51 | 52 | else
|
52 | 53 | sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
|
53 | 54 | fi
|
|
57 | 58 | if [[ -n ${DB-} && x$DB =~ ^xmariadb10.1 ]]; then
|
58 | 59 | if [[ -n ${GITHUB_ACTIONS-} ]]; then
|
59 | 60 | sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.1 libmariadb-dev
|
60 |
| - CHANGED_PWD_BY_RECREATE=true |
| 61 | + CHANGED_PASSWORD_BY_RECREATE=true |
61 | 62 | else
|
62 | 63 | sudo apt-get install -y -o Dpkg::Options::='--force-confnew' libmariadbclient-dev
|
63 | 64 | fi
|
|
72 | 73 | # Install MariaDB 10.3 if DB=mariadb10.3
|
73 | 74 | if [[ -n ${GITHUB_ACTIONS-} && -n ${DB-} && x$DB =~ ^xmariadb10.3 ]]; then
|
74 | 75 | sudo apt-get install -y -o Dpkg::Options::='--force-confnew' mariadb-server mariadb-server-10.3 libmariadb-dev
|
75 |
| - CHANGED_PWD=true |
| 76 | + CHANGED_PASSWORD=true |
76 | 77 | fi
|
77 | 78 |
|
78 | 79 | # Install MySQL if OS=darwin
|
@@ -111,11 +112,11 @@ else
|
111 | 112 | DB_SYS_USER=root
|
112 | 113 | fi
|
113 | 114 |
|
114 |
| - if [ "${CHANGED_PWD}" = true ]; then |
| 115 | + if [ "${CHANGED_PASSWORD}" = true ]; then |
115 | 116 | # https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/
|
116 | 117 | sudo mysql ${MYSQL_OPTS} -u "${DB_SYS_USER}" \
|
117 | 118 | -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''"
|
118 |
| - elif [ "${CHANGED_PWD_BY_RECREATE}" = true ]; then |
| 119 | + elif [ "${CHANGED_PASSWORD_BY_RECREATE}" = true ]; then |
119 | 120 | sudo mysql ${MYSQL_OPTS} -u "${DB_SYS_USER}" <<SQL
|
120 | 121 | DROP USER 'root'@'localhost';
|
121 | 122 | CREATE USER 'root'@'localhost' IDENTIFIED BY '';
|
|
0 commit comments