How do I resolve database SQL server error 4060?
If you use a SQL database, you may encounter SQL Error 4060 following a database migration. This is one of the many SQL Errors that administrators must deal with. SQL Error 4060 occurs on the server. As a result, the client has little control over the situation. You require an immediate solution. We’ll show you how to fix SQL Error 4060 here.
- sql server error 4060 cannot open database
- sql state 08004 sql server error 4060
- fatal sql error 4060 occurred during company login
- unable to open the specified server database 4060
- error number 4060 state 1 class 11
- server rejected the connection; access to selected database has been denied
Cause for SQL Server Error 4060
After migrating a website or application, users may encounter SQL Error 4060, which reads “Connection Failure: Server Rejected the Connection, Access to Selected Database Denied.” This error appears because:
- There were insufficient valid credentials to access the database, so access was denied
- Network Protocol was not enabled
- Access was blocked by a firewall
Solution for SQL Server Error 4060
No valid credentials supplied or credentials have no permission
The most serious problem with SQL Error 4060 is that the user did not have permission to view the database objects. They did not face this problem prior to migration because they had the necessary permission. As a result, after migration, you, as an administrator, should grant them permission.
You must use the Transact-SQL or TSQL command to grant the privileges. This command appears to be:
GRANT <permission>  TO <database_principal>  [ WITH GRANT OPTION] [AS <database_principal>As you can see, the first line of code grants the required permission, and the second line to a specific user.
Similarly, you can grant permissions to other users based on their roles.
This should resolve the issue. If not, move on to the next solution.
All connections to the SQL Server Database Engine require a network protocol, which should be enabled. If not, the database will generate the 4060 error.
2. To resolve Network protocol error for sql server 4060, follow these steps:
- Go to the programme’s list by clicking on “Start”
- From the list, select “SQL Server Configuration Manager”
- Then navigate into SQL Server Network Configuration and Protocols for machine instance>.
- Double click on “Named Pipes”. This will open the Named Pipes Properties tab
- Select “Yes” for the Enabled option and then OK to confirm.
Also like the above, you also need to enabled TCP/IP.
- Go to the list of programs by click on Start and select “TCP/IP”.
- From the properties screen, select “Yes” on the Enabled parameter.
- Now go to the IP Addresses tab and select “Yes” for the IP address.
- Also check for the correctness of TCP Port.
- Finally click “OK”
3.Firewall Blocking issue
If neither of the preceding solutions resolves the problem, it is more likely that a firewall is preventing access to the database. To fix this, simply instruct the firewall to grant the user access. Navigate to the firewalls that have been installed and look for permissions. If it hasn’t already been granted to the user, do so.
SQL Error 4060 can also be caused by other problems. A corresponding database, for example, may not have been properly copied into a new environment. There are also issues with rows and objects. Although these are uncommon, we recommend that you investigate them if the SQL 4060 error persists.