Can't install nextcloud with external DB

Hello everyone,
I’m trying to install nextcloud using external db,
but is keeps throwing error :
SQLSTATE[HY000] [2006] MySQL server has gone away

I modefied the config.php file:

<?php $CONFIG = array ( 'instanceid' => ' ', 'passwordsalt' => ' ', 'secret' => ' ', 'trusted_domains' => array ( 0 => ' ', ), 'datadirectory' => '/var/www/html/nextcloud/data', 'dbtype' => 'mysql', 'version' => '22.1.1.2', 'overwrite.cli.url' => ' ', 'dbname' => 'nextcloud', 'dbhost' => 'ip:3306', 'dbport' => '', 'dbuser' => ' ', 'dbpassword' => ' ', 'dbtableprefix' => 'oc_', ); ~ can you help me please!

As far as I understand you manually enter the database details in the config.php? It’s typically not a good idea to create/fill the config file yourself - you should let the setup script do this part, as it also does other things apart from entering the DB credentials, see also this post

Is there any specific reason you did not use the installer?

first of all check your mysql/mariadb installation.

are you able to connect via mysql-client to your db?

Example from your nextcloud installation:

mysql --host ip -u dbuser -p

Then there must be a password field.
ip is your ip (Maria DB server).
dbuser is your user in the MariaDB.