From e470bcde79524156356e18ca998cc2b40fbf3dc4 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Fri, 8 Jan 2021 16:02:09 +0300 Subject: [PATCH] fix empty password for mysql-server (#2400) --- images/linux/scripts/installers/mysql.sh | 21 +++++-------------- .../linux/scripts/tests/Databases.Tests.ps1 | 5 +++-- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/images/linux/scripts/installers/mysql.sh b/images/linux/scripts/installers/mysql.sh index 8805afb73..2fae8449d 100644 --- a/images/linux/scripts/installers/mysql.sh +++ b/images/linux/scripts/installers/mysql.sh @@ -4,29 +4,16 @@ ## Desc: Installs MySQL Client ################################################################################ -source $HELPER_SCRIPTS/os.sh - export ACCEPT_EULA=Y -if isUbuntu16 || isUbuntu18 ; then - apt-get install mysql-client -y -fi - -if isUbuntu20 ; then - # Install mysql 8 for Ubuntu 20. - - debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-server select mysql-8.0' - package_version=$(curl https://dev.mysql.com/downloads/repo/apt/ 2> /dev/null | grep "\.deb" | awk -F "[()]" '{print $2}') - wget https://dev.mysql.com/get/$package_version - dpkg -i $package_version - apt update -fi - # Mysql setting up root password MYSQL_ROOT_PASSWORD=root echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections +# Install MySQL Client +apt-get install mysql-client -y + # Install MySQL Server apt-get install -y mysql-server @@ -36,3 +23,5 @@ apt install libmysqlclient-dev -y # Disable mysql.service systemctl is-active --quiet mysql.service && systemctl stop mysql.service systemctl disable mysql.service + +invoke_tests "Databases" "MySQL" diff --git a/images/linux/scripts/tests/Databases.Tests.ps1 b/images/linux/scripts/tests/Databases.Tests.ps1 index 330123411..9259c5a8f 100644 --- a/images/linux/scripts/tests/Databases.Tests.ps1 +++ b/images/linux/scripts/tests/Databases.Tests.ps1 @@ -22,9 +22,10 @@ Describe "MySQL" { } It "MySQL Service" { - "sudo systemctl start mysql" | Should -ReturnZeroExitCode + "sudo systemctl start mysql" | Should -ReturnZeroExitCode + mysql -s -N -h localhost -uroot -proot -e "select count(*) from mysql.user where user='root' and authentication_string is null;" | Should -BeExactly 0 "sudo mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot" | Should -ReturnZeroExitCode "sudo mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot" | Should -ReturnZeroExitCode "sudo systemctl stop mysql" | Should -ReturnZeroExitCode } -} \ No newline at end of file +}