aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaIng <micha@dietpi.com>2020-11-23 18:55:50 +0100
committerGitHub <noreply@github.com>2020-11-24 01:55:50 +0800
commitb34d040c784b9a2eabfb192d1432b3f98c0eef02 (patch)
treea99987cd68672019e47951235bd6514f6f83aa98
parentafaf6da4054150ec6317b827cd7514644f76630f (diff)
scripts: fix MySQL script for MariaDB >= 10.3.1 (#6424)
innodb_file_format and innodb_large_prefix have been deprecated with MariaDB v10.2 and removed with v10.3.1. They have been reintroduced with v10.4.3 but remain deprecated and unused: - https://mariadb.com/kb/en/innodb-system-variables/#innodb_file_format - https://mariadb.com/kb/en/innodb-system-variables/#innodb_large_prefix Setting those variables on MariaDB >=10.3.1 leads to the following error: "ERROR 1238 (HY000) at line 7: Variable 'innodb_file_format' is a read only variable" Since semantic versioning patch versions cannot be compared via numeric operators, only the major + minor versions are compared against 10.3. Since v10.2.2 the defaults match the desired values, so there is only the single patch version 10.3.0 where, when explicitly set differently via MariaDB configs, this commit could lead to an unwanted database format. In favour of a simple SQL change, this case is ignored. This commit additionally removes trailing spaces and the doubled trailing empty line. Signed-off-by: MichaIng <micha@dietpi.com>
-rw-r--r--scripts/mysql.sql11
1 files changed, 5 insertions, 6 deletions
diff --git a/scripts/mysql.sql b/scripts/mysql.sql
index 3aab6b7d..37b6899a 100644
--- a/scripts/mysql.sql
+++ b/scripts/mysql.sql
@@ -1,11 +1,10 @@
-SET @s = IF(version() < 8 OR version() LIKE '%MariaDB%',
- 'SET GLOBAL innodb_file_per_table = ON,
- innodb_file_format = Barracuda,
- innodb_large_prefix = ON;',
+SET @s = IF(version() < 8 OR (version() LIKE '%MariaDB%' AND version() < 10.3),
+ 'SET GLOBAL innodb_file_per_table = ON,
+ innodb_file_format = Barracuda,
+ innodb_large_prefix = ON;',
'SET GLOBAL innodb_file_per_table = ON;');
PREPARE stmt1 FROM @s;
-EXECUTE stmt1;
+EXECUTE stmt1;
DROP DATABASE IF EXISTS gogs;
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
-