When I was working on a project, I encountered a problem. When I used ef6.0 to connect to MySQL, it was good locally, but after I went to the server, it was no problem for a period of time. As soon as the amount of concurrency came up, I reported an error [the underlying provider failed on open]. After checking for a long time, I couldn’t find out the reason. I asked Du Niang and Google, Most of them are about the problem of connection string. I have checked the connection string countless times and completely ruled out the problem of connection string
There is also the problem of user permissions, in IIS to add the user permissions, or the same error
Later, I thought that it was only after the amount of concurrency came up that this error occurred. So I wondered if the number of database connections was too small?Maximum number of connections to view data:
show max_connections
The returned result is 151, which is obviously not enough. So try to increase it
set global max_connections=1000;
After the number of connections is set to 1000, the error does not appear again
Maybe the mistake I encountered was just caused by insufficient connection number. I’d like to share it with you