Issue:
Navicat for MySQL error when opening link: 2005-unknown mysql server host ' localhost ' (0)?
When using Navicat to connect to MySQL database:
MySQL error 2005-unknown mysql server host ' localhost ' (0) error;
When checking the connection information, the Connection property information, the user name and password are correct, the IP address is: localhost, in the case of a network can open the database normally, but a broken network error.
The solution is as follows:
When you use Navicat to create a MySQL connection, fill in the host or IP address column: 127.0.0.1 instead of filling out localhost, and then testing in the case of a disconnected network will find that the connection is successful.
The cause of the error is:
In the case of a network, localhost is automatically resolved to 127.0.0.1, while the network is disconnected, localhost is just a string and does not represent an IP address.
The MySQL configuration file is stored in the Hosts file and is located in:
Windows:c:\windows\system32\drives\etc\hosts
Linux:/etc/hosts
Open the configuration file to see at the end of the file, the host IP of localhost is set to 127.0.0.1.
After the change or not, the reason is not here, because there is no MySQL service, so reconfigure the MySQL environment variable
environment variable, advanced settings, properties, computer
Add mysql_home path C:\Program files\mysql\mysql Server 5.5
Then path creates a new%mysql_home%\bin
When the MySQL service suddenly disappears, you can enter mysqld-install at the command prompt to install the service.
In the case of server install denied, enter the System32 folder and run the Cmd.exe file as an administrator.
Then execute the Mysqld-install, which is absolutely successful at this time.
Start MySQL service: net start MySQL
Turn off MySQL service: net stop MySQL
Note: If you have a path in the system to the MySQL installation directory of bin paths!!!
Navicat for MySQL error when opening link: 2005-unknown mysql server host ' localhost ' (0)?