I also got this error, I was installing moodle 3.4 on debian 8, with php 7 and newly installed mysql 5.7.
TLDR: I removed the custom check for storageengine on admin/environment.xml (since I already know my database has the proper configuration there is nothing lost).
The database is already configured as suggested in https://docs.moodle.org/32/en/MySQL_full_unicode_support#Steps_to_upgrade
To test the db configuration, I have manually created a table
create table tmp (id char) ;
and then with
show create table tmp;
I can see the new fielformat, charset and collation (ok, I can not be sure it is a Barracuda file but the charset being utf8mb4 proves the new config is in effect):
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
However, the script halted with the infamous !! Error reading from database !!
annoyingly the install.php script doesn't have a log or verbose option.
So digging into code I found out the culprit was the exception unsupporteddbstorageengine, was being thrown by a custom check on the file admin/environment.xml, here it is:
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<ON_ERROR message="unsupporteddbstorageengine" />
the function check_database_storage_engine reads the metadata of the config table: mdl_config (or what ever your prefix is set to) and if the engine equals "MyISAM" then the unsupported_db_storage_engine result is return, which stops the process.
The thing is, at the moment that check is done, no tables had been created yet, so it always fails!
so I removed the custom check from the .xml (since I already know my database has the proper configuration there is nothing lost) and everything goes fine afterwards.
hope this helps someone else