I had an issue with CDR not showing as well and was baffled beyond words but after much trial and error I have found the solution.
#Install FreePBX
cd /usr/src
tar zxf freepbx-16.0-latest.tgz
cd freepbx
#Create Asterisk Database and Privileges
mysqladmin -p create asterisk
mysqladmin -p create asteriskcdrdb
mysql -p
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY ‘PASSWORD’;
GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY ‘PASSWORD’;
flush privileges;
\q
#Update PEAR modules
pear channel-update pear.php.net
pear install DB MDB2 MDB2 MDB2#mysql MDB2#mysqli MDB2#sqlite
#Install MySQL Connector
cd /usr/src
tar zxf mariadb-connector-odbc-3.1.19-ubuntu-focal-amd64.tar.gz
cd mariadb-connector-odbc-3.1.19-ubuntu-focal-amd64
install lib/mariadb/libmaodbc.so /usr/lib64/
install -d /usr/lib64/mariadb/
install -d /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/caching_sha2_password.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/client_ed25519.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/dialog.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/mysql_clear_password.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/sha256_password.so /usr/lib64/mariadb/plugin/
systemctl restart mariadb
#Create Asterisk Conf files
tee /usr/src/odbc_template.ini<<EOF
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib64/libmaodbc.so
FileUsage = 1
EOF
cd /usr/src
odbcinst -i -d -n MariaDB -f odbc_template.ini
tee /etc/odbc.ini<<EOF
[MySQL-asteriskcdrdb]
Description=MySQL connection to ‘asteriskcdrdb’ database
driver=MySQL
server=localhost
database=asteriskcdrdb
username=ROOTUSERNAME
password=PASSWORD
Port=3306
Socket=/run/mysqld/mysqld.sock
option=3
Charset=utf8
EOF
tee /etc/asterisk/cdr_adaptive_odbc.conf<<EOF
[asteriskcdrdb]
connection=asteriskcdrdb
loguniqueid=1
table=cdr
alias start => calldate
EOF
tee /etc/asterisk/res_odbc_additional.conf<<EOF
[asteriskcdrdb]
enabled=>yes
dsn=>MySQL-asteriskcdrdb
pre-connect=>yes
max_connections=>5
username=>asterisk
password=>PASSWORD
database=>asteriskcdrdb
EOF
systemctl restart mariadb
reload asterisk
In FreePBX Advanced Settings Enable CDR Logging
Apply Settings and make a test call
Remember to change ROOTUSERNAME to your MySQL root user aka root and PASSWORD to your respective MySQL user password