Qualifcations for this response ... don't use Debian, but have installed Moodle on other Linux systems (including Ubuntu).
Is there a config.php flie in code root of your site?
For version 4 of Moodle, DB server versions 5.7/8.0 for
MySQL, and for
MariaDB 10.2.29 to 10.5. Logged on via ssh what does my
sql -V show?
Failed installs, if
database for moodle has been touched, might require dropping the database and re-creating again. IF you have a config.php file at code root, to begin again you might need to erase that file.
As superuser of DB server, from the mysql prompt:
show databases;
Does that show a moodle DB?
and check to see if any tables have been created:
use moodle;
show tables;
\q to quite the mysql client.
In moodlecode/admin/cli/, there are scripts that will install via command line. You will be prompted for the same information as the web based install ... that takes your web server out of the loop for installation.
'SoS', Ken