I have some troubles with IIS client. I mean, when I use tests or just connect in my DB in MSSMS everything is fine. But when I open my site I get the error:
provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred.
** - for secure ofc.
Connection string what I found when I debug code:
Data Source=(LocalDB)\MSSQLLocalDB;integrated security=false;Initial Catalog=**;User ID=**;Password=**;Connection Timeout=60;MultipleActiveResultSets=True;Max Pool Size=1024
Maybe someone can help me, idk how I should fix that because that is rly strange bug. I mean... all tests works ( they have same connections string)
We are using different services in the Azure Cloud (App services / function apps) to connect to a On-Premise MySql database on Ubuntu. This works the most time very well, but sometimes and totally random we received the following error.
Detail:
The connection works most time great and everything seems correct configured. Only sometimes e.g. every 27th request runs into an error. I assume the received error message is maybe wrong.
Example extract from our log:
2018-02-21 15:53:55.647 +00:00 [Error] Microsoft.EntityFrameworkCore.Database.Connection: An error occurred using the connection to database 'XXXXXXX' on server 'XXX.XXX.XXX.XXX'.
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
at MySqlConnector.Core.ServerSession.<ConnectAsync>d__56.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 212
We are connecting to this database from different sites, but this error only appears from the Azure Cloud.
We double-checked the connection string, firewall settings and outgoing IPs several times.
Connection String:
Persist Security Info=True;server=xxx.xxx.xxx.xxx;database=xxxxxx;uid=xxxxx;password=xxxxx;port=3306;
On some days we doesn’t received this error, but on the other day many times per day and totally random. It would be great to get help from you to identify the problem and solve it soon. Thanks a lot!
It is hard to help without a code example.
You can only check the common things:
- connection string correct order
"Server=TheServerAddress; Port=YourPortNumber; Database=YourDatabase; Uid=YourUsername; Pwd=YourPassword;"
- add default port. Ex.: 3306 to connection string
- check the query code async or not and if its the same in other application
Also you can try a retry:
https://blogs.msdn.microsoft.com/bartr/2010/06/20/sql-azure-connection-retry-update/
http://peterkellner.net/2011/01/21/sqlazure-connection-retry-problem-using-best-practices/
I have been facing the following error intermittently.
Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Reading from the stream has failed.
It shots up any time and I am at my wits end. I also posted a bug on MySQL bugs and solutions are not proving to be effective in any way.I hope you guys can help me out.
Here is the link to MySQL Bug for details: Never seems to go away!
Some more detail: I have a client-server system but this bug occurs on the server system(where MySQL database is installed) when a local running app on the server system tries to run a query.
I had already opened a question here but since has been dead. Just a caveat I thought that skip-name-resolve solved the issue but it seems to just have lowered the frequency. Hope someone would help me out this time around.
EDIT: The MySQL guys say that in a client server setup server may close a connection if it is unused for a long time. However, this is not what I am facing as I create a new connection everytime I want to execute a query. I made this point clear in the last comment on the MySQL Bugs.
Guys I tried this: "SslMode=None" in the connection string, but if you need SSL then read this:
http://www.voidcn.com/article/p-phfoefri-bpr.html
here is a sample connection string that works:
connectionString="Server=192.168.10.5;Database=mydata;Uid=root;Pwd=****;SslMode=None"
Hope this helps
I've been getting this error, quite frequently with Amazon's MySQL RDS instances. And most multi-AZ instances.
It would be interesting to compare notes to see if others mostly get this issue with RDS also?
Amazon is known to rely heavily on "fast" DNS changes to switch over stuff with things like ELBs. I wonder if the same thing is happening with RDS? Or some other internal AWS switching is messing up the idle connections in the pool.
This would explain why the Oracle devs can't reproduce it and don't see it as much of an issue.
Anyway I've had to just deal with it and add retry logic when opening a connection.
This issue is caused by Ssl.
Solution 1: SSL is not required. Since it is caused by SSL, we can turn off SSL by appending "SslMode=None" to the connection string.
Solution 2: SSL is required, server identity is important and needs to be verified. The server needs a internet connection to do the cert verification. Please note the crypto API doesn't update CTL for every process. The CTL is maintained at operating system level. Once you connect the server to connect and make an SSL database connection to the server, the CTL will be updated automatically. Then you may disconnect the internet connection. Note again the CTL has its expiration date and after that the Windows needs to update it again. This will occur probably after several months.
Solution 3: SSL is required but the server identity is not important. Typically SSL is only used to encrypt the network transport in this case. We can turn off CTL update:
Press Win+R to open the "Run" dialog
Type "gpedit.msc" (without quotes) and press Enter
In the "Local Group Policy Editor", expand "Computer Configuration", expand "Administrative Templates", expand "System", expand "Internet Communication Management", and then click "Internet Communication settings".
In the details panel, double-click "Turn off Automatic Root Certificates Update", clickEnabled, then click OK. This change will be effective immediatelly without restart.
http://www.voidcn.com/article/p-phfoefri-bpr.html
unfortunately, this error occurs if the application and mysql are on the same computer, if you move it to a different computer it is fine.
I tried many ways but for now there is no other solution. bug has been reported many times by others https://bugs.mysql.com/bug.php?id=76597
I had the exact same problem performing the upgrade on a windows form application. The solution I found was to change the server, because that one was in trouble. On the server that was presenting the similar situation you described had installed WordPress with MYSQL 5.6.34, on the other I did a clean install with MYSQL version 5.6.26.
I don't know if it has to do with the environment variables used. I believe it has nothing to do with Connection Timeout, if it is a property that is used only with the open connection. This error occurred in a shared environment as well as in a local installation with Maria DB. Another problem I found was that one of the selection commands that retrieved the data was having a problem in its formation not respecting the blanks:
SELECT COLUNA1, COLUNA2 FROM TABLE;
I made the change to SELECT COLUMN1, COLUMN2 FROM TABLE;
I am still testing on this solution I presented, and as of the time of posting there were no more errors.
I was getting the error
Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message: Reading from the stream
I solved it when I put SslMode=None in my connection string.
However, I checked that the message is different from you
Check my connection
connection.ConnectionString = "server=myadressserver;userid=myuser;password=mypassword;database=test;SslMode=None";
I realise that this problem has been raised many times and a number of suggestions for how to fix it have been made, but despite following many of these suggestions, including all the one's listed here: How to solve Error 26: Error Locating Server/Instance Specified in production environment?
and here: http://blogs.msdn.com/b/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx
and turning the firewall off I still can't resolve my problem. I have a WCF service that I am running via Visual Studio Express 2012 for Web. The service talks to a database I have set up in SQL Server Management studio. The server, database and service are all running locally on a windows 8 laptop. I connect the to service via a WPF application on the same laptop. This is a development version hence running it all on the laptop. This works fine on one laptop but when I transfer everything over to another laptop I get the error: 26 issue. Both laptops are the same (same make/model/spec/OS).
The machine that works has the following connection string (where laptop-name is the name of my laptop and DBname is the name of the database):
<add name="AirportTaxiAccountsPackageDBConnectionString" connectionString="Data Source=laptop-name\SQLEXPRESS;Initial Catalog=DBname;Integrated Security=True"
providerName="System.Data.SqlClient" />
NB:the set up details within SQL server management studio are: server name is laptop-name\SQLEXPRESS and the connection is laptop-name\user-nameA
The machine that doesn't work has the following connection string:
<add name="AirportTaxiAccountsPackageDBConnectionString" connectionString="Data Source=laptop-name\SQLEXPRESS;Initial Catalog=DBname;Integrated Security=True"
providerName="System.Data.SqlClient" />
NB: the set up details within SQL server management studio on this computer are: server-name is laptop-name\SQLEXPRESS and the connection is laptop-name\user-nameB
This connection string was set up on the second laptop by creating and testing the connection from within VS via the database connection wizard. when I test the connection via the wizard it works fine, it's only when I connect to it via my wpf application that a connection problem occurs.
One last thing, I checked the service is runnning correctly on the second laptop, it is fine and I can connect to it, the problem occurs when I try to access the database. the process is run service using host, connect to service via WPF, connect to database > error 26
Any ideas?
Edited again
i've set up a test client which can access the service, I get the same error which is the error 26 error locating server/instance specified
RESOLVED
I was hard coding the database configuration details again via a class within the service rather than talking to the configuration file!! I am a dufus but now I know better :)
I had hard coded the database connection string into configuration class within the service which was overwriting the database connection string in the app.config file blush
I'm connecting to MySQL via C# using MySQLHelper. Problem came when I released my app. In debug mode it's connecting fine, but in release it shows: Unable to connect to any of the specified MySQL hosts.
My connection string I hard-code, not storing in any config files. I thought problem might be in some compiler optimizations, but there are nothing to optimize. I even made some custom debug, showing variables after error. My connection string in release mode looks exactly the same as in debug mode.
I use MySQL from hosting. I have set it to remote connections. In fact its working in debug mode so its not this cause a problem.
Unbelievable... I solved it.
It seems in debug mode C# could change hostname to IP in connection string.
I tried to use IP instead of hostname in connection string and now it's working in Release mode also.