[Ubuntu] do not install mysql 8.x on 18.04 (#4685)

This commit is contained in:
Mikhail Koliada
2021-12-08 16:02:06 +03:00
committed by GitHub
parent 07a22999fe
commit 4d7a8a0e35
2 changed files with 47 additions and 24 deletions

View File

@@ -5,12 +5,17 @@
################################################################################ ################################################################################
source /etc/os-release source /etc/os-release
source $HELPER_SCRIPTS/os.sh
# Mysql setting up root password # Mysql setting up root password
MYSQL_ROOT_PASSWORD=root 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 password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
# Ubuntu's repo now contains 8.0.28 which is buggy,
# see https://bugs.mysql.com/bug.php?id=105288
if isUbuntu20 ; then
mkdir -p /tmp/mysql mkdir -p /tmp/mysql
pushd /tmp pushd /tmp
@@ -39,6 +44,24 @@ mysql_debs=(
for package in ${mysql_debs[@]}; do for package in ${mysql_debs[@]}; do
dpkg -i $package dpkg -i $package
done done
# Start mysql to change its settings
systemctl start mysql.service
# Enable mysql log-in without sudo by activation of the mysql_native_password plugin
mysql -s -N -h localhost -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; FLUSH PRIVILEGES;"
else
export ACCEPT_EULA=Y
# Install MySQL Client
apt-get install mysql-client -y
# Install MySQL Server
apt-get install -y mysql-server
#Install MySQL Dev tools
apt install libmysqlclient-dev -y
fi
# Disable mysql.service # Disable mysql.service
systemctl is-active --quiet mysql.service && systemctl stop mysql.service systemctl is-active --quiet mysql.service && systemctl stop mysql.service
systemctl disable mysql.service systemctl disable mysql.service

View File

@@ -31,7 +31,7 @@ Describe "MySQL" {
It "MySQL Service" { It "MySQL Service" {
"sudo systemctl start mysql" | Should -ReturnZeroExitCode "sudo systemctl start mysql" | Should -ReturnZeroExitCode
sudo mysql -s -N -h localhost -uroot -proot -e "select count(*) from mysql.user where user='root' and authentication_string is null;" | Should -BeExactly 0 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 'CREATE DATABASE smoke_test' -uroot -proot" | Should -ReturnZeroExitCode
"sudo mysql -vvv -e 'DROP 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 "sudo systemctl stop mysql" | Should -ReturnZeroExitCode