Как правильно закрыть соединение в MySQL

В многопотоке заношу данные в БД. В какой то момент выдаёт ошибку.

CONN_STRING = "server=localhost;user=newuser;database=xxx;password=xxx;default command timeout=1000;";
using (MySqlConnection con = new MySqlConnection(CONN_STRING ))
{
    con.Open();
    
    var sql = $"INSERT INTO ....)";

    using (MySqlCommand cmd = new MySqlCommand(sql, con))
    {
        cmd.CommandTimeout = 60;
        cmd.ExecuteNonQuery();
    }
}

Unhandled exception. System.AggregateException: One or more errors occurred. (error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.) (error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.) (error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.) ---> MySql.Data.MySqlClient.MySqlException (0x80004005): error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

Настройки mysql

[mysqld]

wait_timeout=600
interactive_timeout = 600
key_buffer_size         = 16M
max_allowed_packet      = 16000M
thread_stack            = 192K
thread_cache_size       = 8
myisam-recover-options  = BACKUP
max_connections        = 1500

Ответы (2 шт):

Автор решения: Aziz Umarov

Попробуйте вызывать явно

con.Close();

когда освободится.

→ Ссылка
Автор решения: Radzhab

Удалил MySQL.Data.dll. Поставил пакет https://www.nuget.org/packages/MySqlConnector/ и без единой правки кода все заработало. Только using изменил - а код не трогал вообще

→ Ссылка