diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b56cc8c..1aeb1d604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix transcoding content with bt709/pc color metadata - Fix scripted schedule validation (file exists) when creating or editing playout - Fix adding single episode, movie, season, show to empty playlists +- Fix startup with MySql as non-superuser + - `local_infile=ON` is required when using MySQL (for bulk inserts when building playouts) + - ETV will set this automatically when it has permission + - When ETV does not have permission, startup will fail with logged instructions on how to configure MySql ### Changed - **BREAKING CHANGE**: change how `Scripted Schedule` system works diff --git a/ErsatzTV.Infrastructure/Data/DbInitializer.cs b/ErsatzTV.Infrastructure/Data/DbInitializer.cs index 4cb0c7ffa..a87d2d284 100644 --- a/ErsatzTV.Infrastructure/Data/DbInitializer.cs +++ b/ErsatzTV.Infrastructure/Data/DbInitializer.cs @@ -15,7 +15,27 @@ public static class DbInitializer } else { - await context.Connection.ExecuteAsync("SET GLOBAL local_infile = true", cancellationToken); + int localInfile = await context.Connection.ExecuteScalarAsync( + "SELECT @@GLOBAL.local_infile"); + + if (localInfile == 0) + { + try + { + await context.Connection.ExecuteAsync("SET GLOBAL local_infile = 'ON'", cancellationToken); + } + catch + { + Serilog.Log.Fatal( + """ + ErsatzTV requires local_infile=ON when using MySQL. + Please run the following as a MySQL administrator: + SET GLOBAL local_infile = 'ON'; + Or configure it in my.cnf under [mysqld]. + """); + throw; + } + } } if (!context.LanguageCodes.Any())