Question: I tried to solve this with logarithm rules:

O(n^2) = 2^O(log(n^2)) 

c\*n^2 = 2^log(n^2c)

Im not sure that is true?

Answer: 
As explained in other answers, the problem usually comes from having the wrong Initial project in Package Manager Console.
In my case the console was ignoring the value I selected in the Default Project drop down list, and also the `-StartUpProjectName` parameter, and reproducing the wrong behavior of trying to connect to some default database engine, as Mikk's answer describes, in my case using a SqlExpress engine.

My problem was caused by a wrong solution configuration: if your solution has several projects and is meant to be run with the configuration option "Multiple startup projects", but you just downloaded it from your source code control repository, then it is possible that the default configuration option "Single startup project" is being applied to the solution (this config value usually is not checked-in in the source code control). In this case the Package Manager Console just ignores the startup project selected in its combo and just applies the default startup project in the solution, which may not have a connection string, as specified in Mikk's answer.

So I fixed it by changing the solution properties: `Common properties` / `Startup project` / Select `Multiple startup projects` instead of `Single startup project`, and after that the Package Manager Console would accept the Project name and update the right database.
> 
> A network-related or instance-specific error occurred while
>  establishing a connection to SQL Server. The server was not found or
>  was not accessible. Verify that the instance name is correct and that
>  SQL Server is configured to allow remote connections. (provider: SQL
>  Network Interfaces, error: 26 - Error Locating Server/Instance
>  Specified)
> 
> 
> 

This error message informs you that it is not possible to connect to `SQL Server`. The possible reasons and their elimination is described below:

1) SQL Server is not started. Starting of it will allow you to see your SQL Server/instance in the drop-down list of available SQL Servers.

* Go to the Start menu -> Control Panel -> Administration Tools ->
Services.
* In the list of services find SQL Server (instance name, by
default it is EZPARTS5) and check its status, it must be Started  

(if it is not started, then right click on SQL Server and select  

Start from the context menu).

2) Firewall is blocking port 1433 (MSSQL standard port for connections). It can be disabled following the steps below: 

* Go to the Start menu -> Control Panel -> Administration Tools ->
Services.
* Find Firewall service, it must be disabled (if it is not, then right
click the service and select Stop from the context menu).

Note: More information on this can be found on the official Microsoft site: [***Link***](http://msdn.microsoft.com/en-us/library/cc646023.aspx)

3) TCP/IP protocol is disabled for MSSQL protocols. To enable it, see the steps below:

* Navigate to SQL Server Configuration Manager in the Start menu.
* Specify settings for TCP/IP protocol in SQL Server Configuration
Manager.
* Restart the computer.

Note: More information on this can be found on the official Microsoft site: [***Link***](http://msdn.microsoft.com/en-us/library/bb909712%28v=vs.90%29.aspx)

4) Make sure your database engine is configured to accept remote connections (If you are using centralized database):

* Open SQL Server Management Studio.
* Right click SQL Server instance -> Properties -> Connections -> 
Check the Allow remote connections to this server box.
* Go to the General section and check name of SQL Server specified in
the Name field.

5) If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings. Usually the format needed to specify the database server is machinename\instancename.

6) Make sure your login account has access permission on the database you used during login.
Alternative:
If you still can’t get any connection, you may want to create a SQL account on the server, a corresponding SQL user on the database in question, and just use this username/password login data to connect to SQL Server.

Referred from this [***link***](http://support.sysonline.com/support/articles/4000016491-errmsg-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql)