Migrations tool does not detect database

I'm having the following issue when trying to connect to a database

An error occurred using the connection to database '' on server 'nserverName.eu-west-3.rds.amazonaws.com:3306'. System.InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call. ---> MySqlConnector.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.

Inspecting the connection string it looks just fine


but when applying migrations for example the above error pops in.

The setup

Infrastructure hosting in AWS. I've used terraform to build it, before that the infrastructure was build from aws console. Connectiong from my application to the region where the infrastructure was build from console works just fine, but it fails when I'm trying to connect to the rds hosted in the region build with terraform.

Inspecting the resources from both regions, I can see that the engine is the same MariaDb as well for the version 10.4.13.

I have not idea why I'm facing issues for the one build with terraform but not for the other.


when running the application, it seems that the error is a little different, the database name is not an empty string anymore.

An error occurred using the connection to database 'myDbBanana' on server 'nserverName.eu-west-3.rds.amazonaws.com:3306'.

Using Dbeaver I have no issues connecting to the database.

C# configuration

                (serviceProvider, dbOptions) =>
                    if (string.IsNullOrWhiteSpace(InMemorySecretsStore.Instance.ConnectionString))
                        IOptions<SecretsOptions> options = serviceProvider.GetRequiredService<IOptions<SecretsOptions>>();
                        AwsSecretsManagementClient awsSecretsManager = serviceProvider.GetRequiredService<AwsSecretsManagementClient>();
                        InMemorySecretsStore.Instance.ConnectionString = awsSecretsManager.GetRdsConnectionStringAsync(options.Value.RdsConnectionSecretId).Result;

                        new MariaDbServerVersion(new Version("10.4.13")),
                        mySqlOptionsAction: mysqlOptions =>
                                maxRetryCount: 3,
                                maxRetryDelay: TimeSpan.FromSeconds(10),
                                errorNumbersToAdd: null);

I've managed to make it work, but I don't understand the reason behind it. The way I've done it, was to move the port part from the server part of the connection string to port section , so my connection string become from this


to this


Any idea why this might be the case ?