Unable to connect to database during installation

I am trying to install the latest version (7.11.20) SuiteCRM. PHP7.4.20, MariaDB 10.3.29, Apache 2.4.41 are installed. I see a Connection Refused error in suitecrm.log.
I have tried bind-ip address to localhost/127.0.0.1,, 0.0.0.0 but it has not worked. For the first two it gives me a connection refused error and the last two it shows that ‘MySQL server has gone away’ error. I have precreated the database, database user with Grant All option, so using the ‘Existing user’ option. It really didnt matter if I asked the installer to create a new user, still shows the same error.

What am I doing wrong?

Hi @swanand0401,
Firstly I want to know which server do you use ?

=>WAMP- MariaDB 10.3.29 support this.

=>XAMP-Not Support

Thank you for your reply. I am using LAMP

@swanand0401

Does the database user have the password?
I recommend to use ip address directly (127.0.0.1).
Can you make screenshot of installation parameters?

Yes, the DB user uses a password and I believe I am using it correctly. I can login to the DB using the same credentials - mysql -u -p. I am using the IP (not using 127.0.0.1 as it is not from the localhost that I am trying to connect but from another PC’s browser within the network [192.168.*. * ]). Will provide a screenshot shortly.

@swanand0401

Try to connect from another computer using command such as:

mysql --user <username> --database <dbname> --host <ip_address_or_domain> --password

Because if you connect through browser it will be as local connection.

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘192.168.10.XXX’ (111 “Connection refused”).This is what I get, when I try to connect from a different VM in the network. Would really appreciate any assistance.

@swanand0401
Maybe problem with port number, add the parameter --port 3306. This number is actual for my server.

If the error you’re getting is still ‘MySQL server has gone away, you have a more serious problem.

Have a look here:

https://dev.mysql.com/doc/refman/8.0/en/gone-away.html

it’s not your typical “I can’t get the connection settings right” problem, it’s a database server crash…

Hi. Thank you for the response. The gone away error was coming when the bind address is changed from 127.0.0.1 to the network IP assigned by DHCP. When I now connect from a different VM on the network, I get connection refused.

@swanand0401

The address or port blocked in your network.
Look at the information from link @pgr wrote about

"

  • It is also possible to see this error if host name lookups fail (for example, if the DNS server on which your server or network relies goes down). This is because MySQL is dependent on the host system for name resolution, but has no way of knowing whether it is working—from MySQL’s point of view the problem is indistinguishable from any other network timeout.
    You may also see the MySQL server has gone away error if MySQL is started with the skip_networking system variable enabled.
    Another networking issue that can cause this error occurs if the MySQL port (default 3306) is blocked by your firewall, thus preventing any connections at all to the MySQL server.

"

So I have installed SuiteCRM on my stage server without any issues. This stage server is on the same network and is running sans issues. I am now trying to perform another installation on a different VM. This would be my production instance. The only difference between both installations is that the stage is Ubuntu 18.04 and production is Ubuntu 20.04. I am even installing the same MariaDB, PHP, Apache and SuiteCRM versions that I have running on staging.

In view of the above, we can safely say that there is no issue in the DNS/network/firewall.

@swanand0401

Check configuration on your VM. Is it using NAT? Maybe outgoing traffic work normal, but incoming do not has correct routing.

So, I was able to solve this issue by binding the address to 0.0.0.0 in the 50-server.cnf and creating a new user with the following commands:

CREATE USER ‘testusr’@‘localhost’ IDENTIFIED BY ‘<New Password’>;

GRANT ALL PRIVILEGES ON . TO ‘testusr’@‘localhost’ WITH GRANT OPTION;

CREATE USER ‘testusr’@’%’ IDENTIFIED BY ‘<New Password’>;

GRANT ALL PRIVILEGES ON . TO ‘testusr’@’%’ WITH GRANT OPTION;

FLUSH PRIVILEGES;

. I am aware this is not the optimal solution from a security perspective and any insights on how best to configure this will be much appreciated