Recently when I was trying to create a new connection in user profile synchronization connections I got the below error which says:
An error has occurred while accessing the SQL Server database or the SharePoint Server Search service. If this is the first time you have seen this message, try again later. If this problem persists, contact your administrator.
The solution what I tried was:
Do an IISRESET in the server. Then it worked correctly.
You can also check the User Profile Synchronization Service should be in started stage. If required also you can restart the service once.
Hope this will be helpful.
You May Also like the Following SharePoint Tutorials: