Couldn't find RT_System user in the DB & error reading data from FastCGI server

I followed the instructions from the installation steps provided here— ManualInstallation, but I cannot get the Setting up RT’s webserver to work. I cannot find a solution to the following issues:

RT couldn't connect to the database where tickets are stored.

If this is a new installation of RT, you should visit the URL below

to configure RT and initialize your database.

If this is an existing RT installation, this may indicate a database

connectivity problem.

The error RT got back when trying to connect to your database was:

Couldn't find RT_System user in the DB 'dbi:mysql:dbname=rt5;host=localhost'

Since your configuration exists (/opt/rt5/etc/RT_SiteConfig.pm) but is not writable, I'm refusing to do anything.

[fcgid:warn] [pid 6886] (104)Connection reset by peer: [client 130.000.76.8:46739] mod_fcgid: error reading data from FastCGI server

[core:error] [pid 6886] [client 130.000.76.8:46739] End of script output before headers: rt-server.fcgi

The RT_SiteConfig.pm is readable and writable but I am not sure why it says it’s not writable. Also, I have tried setting up a timeout for the fcgi issue but it did not work. I really appreciate any of your suggestions. Thank you in advance.

Did you run make initdb to create the db? Can you confirm the database exists?

The site config file is readable/writable by the Apache user?

According to the Manual installation:

RT includes a tool to help you set up its database. By default, it connects to the database as an administrator to create the database and user that you configured in the previous step.

When I tried to run the provided script in the manual installation:
sudo sbin/rt-setup-database --action=init

I got the issue over here: DBD::mysql::st execute failed: Access denied for user 'rt_admin'@'localhost' to database 'rt5'
I am not sure why the step failed at: inserting database ACLs. Also, when I try to redo this step it says the DB already exists. But I can access DB through MySQL shell. Also, the RT_SiteConfig.pm is readable and writable.

Oh didn’t realize this was the same issue.

Version: ‘5.7.36-0ubuntu0.18.04.1’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 (Ubuntu)
[Note] Aborted connection 11 to db: ‘rt5’ user: ‘rt_user’ host: ‘localhost’ (Got an error reading communication packets)

I’d say dig into this, it sounds like the “reading communication packets” is pretty generic though

I tried to follow the suggestions for reading communication packets issue on the following links

Mostly, all of the suggestions are the same suggesting increasing thread_cache_size or the max_allowed_packet or something that deals with requests to prolong the time. But in my situation, I have this issue in the rt.conf file which I cannot find easy to deal with.
According to the documentation, I must have this line in rt.config=> ScriptAlias / /opt/rt5/sbin/rt-server.fcgi/

But, when I add this line, it gives
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
So, when I comment out the ScriptAlias part then I see the following on my webpage:

You're almost there! You haven't yet configured your webserver to run RT. You appear to have installed RT's web interface correctly, but haven't yet configured your web server to "run" the RT server which powers the web interface.

I am not sure what is the core issue. I think the following is the real problem I need to deal to fix but cannot find correct way to fix it.

[fcgid:warn] [pid 17109] (104)Connection reset by peer: [client 130.245] mod_fcgid: error reading data from FastCGI server
[core:error] [pid 17109] [client 130.245] End of script output before headers: rt-server.fcgi

Here is my system info=> trying to install Request Tracker 5.0.2 with Apache2 on VM with config.— Ubuntu 18.04.6 LTS; Release:18.04;

Here is the complete error message I get in /var/log/apache2/error.log:

RT couldn't connect to the database where tickets are stored.

If this is a new installation of RT, you should visit the URL below

to configure RT and initialize your database.

If this is an existing RT installation, this may indicate a database

connectivity problem.

The error RT got back when trying to connect to your database was:

Couldn't find RT_System user in the DB 'dbi:mysql:dbname=rt5;host=localhost'

Since your configuration exists (/opt/rt5/etc/RT_SiteConfig.pm) but is not writable, I'm refusing to do anything.

[fcgid:warn] [pid 17109] (104)Connection reset by peer: [client 130.245] mod_fcgid: error reading data from FastCGI server

[core:error] [pid 17109] [client 130.245] End of script output before headers: rt-server.fcgi