Navicat for MySQL error when opening link: 2005-unknown mysql server host ' localhost ' (0)?

Source: Internet
Author: User



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)?


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.