@@ -30,6 +30,19 @@ public function setupDatabase(): void {
3030 $ connection = $ this ->connect (['dbname ' => null ]);
3131 }
3232
33+ // for MD5 support
34+ if ($ connection ->getDatabasePlatform () instanceof MySQL84Platform) {
35+ $ statement = $ connection ->prepare ("SHOW VARIABLES LIKE 'version'; " );
36+ $ result = $ statement ->executeQuery ();
37+ $ row = $ result ->fetchAssociative ();
38+ $ version = $ row ['Value ' ];
39+ [$ major , ] = explode ('. ' , strtolower ($ version ));
40+ if ((int )$ major >= 9 ) {
41+ $ statement = $ connection ->prepare ("INSTALL COMPONENT 'file://component_classic_hashing'; " );
42+ $ statement ->executeStatement ();
43+ }
44+ }
45+
3346 if ($ this ->tryCreateDbUser ) {
3447 $ this ->createSpecificUser ('oc_admin ' , new ConnectionAdapter ($ connection ));
3548 }
@@ -103,12 +116,6 @@ private function createDBUser(IDBConnection $connection): void {
103116 $ connection ->executeStatement ($ query , [$ name ,$ password ]);
104117 $ query = "CREATE USER ?@'%' IDENTIFIED WITH caching_sha2_password BY ? " ;
105118 $ connection ->executeStatement ($ query , [$ name ,$ password ]);
106- } elseif ($ connection ->getDatabasePlatform () instanceof Mysql80Platform) {
107- // TODO: Remove this elseif section as soon as MySQL 8.0 is out-of-support (after April 2026)
108- $ query = "CREATE USER ?@'localhost' IDENTIFIED WITH mysql_native_password BY ? " ;
109- $ connection ->executeStatement ($ query , [$ name ,$ password ]);
110- $ query = "CREATE USER ?@'%' IDENTIFIED WITH mysql_native_password BY ? " ;
111- $ connection ->executeStatement ($ query , [$ name ,$ password ]);
112119 } else {
113120 $ query = "CREATE USER ?@'localhost' IDENTIFIED BY ? " ;
114121 $ connection ->executeStatement ($ query , [$ name ,$ password ]);
0 commit comments