Apache server with SQL authentication

ello, I’m a new in linux, I’m doing an exercise where I have to make an apache server and every time I try to authenticate myself in this server, I should enter credentials that I create in a sql database. Unfortunately I’m not finding much on how to do it, could someone help me? ie i installed apache and it works, i installed mysql and it works, but how do i connect them? how do i secure my apache server with sql? I’m using almalinux9

If it’s sufficient for your needs, there’s baked-in support in apache/httpd for using the basic and digest auth types with a database backed auth provider. Have a look at mod_authn_dbd - Apache HTTP Server Version 2.4. The config example uses the postgresql driver, but mysql is available as well. Refer to mod_dbd - Apache HTTP Server Version 2.4.