Unable to connect to any of the specified MySQL hosts

We have a CIB set up using the MemSQL Operator running on Azure. Just recently we started getting connection errors like the ones bellow:

—> MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
—> System.AggregateException: One or more errors occurred. (Connection refused)
—> System.Net.Sockets.SocketException (111): Connection refused
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
— End of stack trace from previous location —
at System.Net.Sockets.TcpClient.CompleteConnectAsync(Task task)
— End of inner exception stack trace —
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at MySql.Data.Common.StreamCreator.GetTcpStream(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()


Fatal error encountered during data read.
MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during data read.
—> MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed.
—> System.IO.IOException: Unable to read data from the transport connection: Connection timed out.
—> System.Net.Sockets.SocketException (110): Connection timed out
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
— End of inner exception stack trace —
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

Where would I go to look into what SingleStore is doing? What possible logs files could I look to?
The dashboard doesn’t show anything wrong.

Hi Paulo. Welcome to the community :wave:

Sorry you are experiencing this issue. Are you on the managed or self-hosted service & what version?

Hi Maria,

I’m on the self hosted service (on Azure) with version 7.8.8

Hey Paulo,

If this is running on the memsql k8s operator I would check the tail of the operator pod to see if it is stuck on an error, I would then check that all of the pod statefulsets are ready using kubectl get statefulsets. If there are no issues there than the error is most likely with the k8s service that is routing traffic to your pods, debugging this is very dependent on your k8s setup but I would check out this as a starting point.

Regards,
Brooks

1 Like

In some of the ways, spacing and the order of parameters in the MySql connection string does matters. So, stick to the standard format:

MysqlConn.ConnectionString = "Server=localhost;Port=1234;Database=My_Mysql_Database;Uid=root;Pwd=root;"

If the above connection string fails, try update your mysql connection string as shown below (without port variable as well):

MysqlConn.ConnectionString = "Server=localhost;Database=My_Mysql_Database;Uid=root;Pwd=root;"

Or, sometime the problem could be on your windows firewall, make sure your server allow access to all port associated with your mysql database.

thanks it helps me so