Causes and solutions for database connection failure: 1. The login account, password, server name, and database name are incorrect and should be entered correctly; 2. The SQL server cannot be installed correctly and should be installed correctly; 3. Network There is a fault in the connection, and the network should be checked to see if there is a fault.
#The operating environment of this article: Windows 7 system, Dell G3 computer.
Causes and solutions for database connection failure:
Cause one: Login account, password, server name, database name login errors lead to failure Connection, this is relatively common, carefully check whether the information filled in is correct. If it is filled in correctly, it can usually be solved.
Solution: When the software being used fails to connect to the database, it is usually a problem with the server name. Changing the server name can generally solve the problem. If the database is installed on this machine, the server name can be replaced by "." or "(local)"; if it is installed on another computer in the LAN, the IP address can be used as the server name.
Cause two: If the SQL server is not installed correctly, the database connection will not be able to be connected; after the database is installed, if the SQL service manager does not start, You have to go to the service to open it.
Solution: If the SQL database fails to be installed successfully, when you reinstall it again, the installation may not be possible, prompting that there is an unfinished installation hang. The solution is: open the registry editor, find and delete the PendingFileRenameOperations project in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager.
If you change the Windows user name or password, the SQL Service Manager will not start. The solution is to go to the service in the control panel to modify the startup.
Specifically: click Start-->Settings-->Control Panel-->Management Tools-->Services-->Find the MS SQL SERVER service-->Right-click on it- ->Properties-->Login-->Modify the account and password for starting the service.
Reason 3: The database cannot be connected due to permission issues. The solution is to detect the computer's security protection restrictions, SQL Server security settings, and operating system security restrictions.
Solution: You can temporarily turn off the firewall or anti-virus software to see if it is caused by the security settings of these software.
SQL Server Security Settings: Open Enterprise Manager--> Expand the SQL Server group--> Right-click the server name--> Click Properties--> In SQL Server Properties--> In Security, select "Authentication" as "In SQL Server and Windows";
If the SQL server uses a Windows XP system, when the workstation computer cannot connect to the database, you can Create an identical WINDOWS user account and password for each workstation
Cause four:Cause: There is a fault in the network connection;
Solution: Check whether there is a fault in the network.
Related video recommendations: PHP programming from entry to proficiency
The above is the detailed content of What are the reasons and solutions for database connection failure?. For more information, please follow other related articles on the PHP Chinese website!